Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dearrow #343

Merged
merged 3 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.

- Use own or public server
- Subscription management
- SponsorBlock
- SponsorBlock + DeArrow (click bait removal)
- Video view/progress tracking
- Playlists
- background playback
Expand Down
2 changes: 1 addition & 1 deletion fastlane/metadata/android/en-US/full_description.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<p><i>Clipious</i>is an Android client for Invidious, the privacy focused YouTube front end.</p><p><b>Features:</b></p><ul><li>Use own or public server</li><li>Subscription management</li><li>SponsorBlock</li><li>Video view/progress tracking</li><li>User playlists</li><li>Background playback</li><li>Live stream support</li><li>Android TV UI</li><li>Audio playback</li><li>Video / audio download</li><li>Video filtering</li><li>Return Youtube Dislikes</li></ul>
<p><i>Clipious</i>is an Android client for Invidious, the privacy focused YouTube front end.</p><p><b>Features:</b></p><ul><li>Use own or public server</li><li>Subscription management</li><li>SponsorBlock + DeArrow</li><li>Video view/progress tracking</li><li>User playlists</li><li>Background playback</li><li>Live stream support</li><li>Android TV UI</li><li>Audio playback</li><li>Video / audio download</li><li>Video filtering</li><li>Return Youtube Dislikes</li></ul>
3 changes: 1 addition & 2 deletions lib/channels/views/components/info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ChannelInfo extends StatelessWidget {
childAspectRatio: getGridAspectRatio(context),
children: channel.latestVideos?.map((e) {
VideoInList videoInList = VideoInList(e.title, e.videoId, e.lengthSeconds, 0, e.author, channel.authorId,
channel.authorId, 0, '', e.videoThumbnails);
channel.authorId, 0, '', e.videoThumbnails)..deArrowThumbnailUrl = e.deArrowThumbnailUrl;
videoInList.filtered = e.filtered;
videoInList.matchedFilters = e.matchedFilters;
return VideoListItem(
Expand All @@ -84,7 +84,6 @@ class ChannelInfo extends StatelessWidget {
child: Thumbnail(
width: double.infinity,
thumbnailUrl: ImageObject.getBestThumbnail(channel.authorThumbnails)?.url ?? '',
id: 'channel-banner/${channel.authorId}',
decoration: BoxDecoration(
color: colors.secondaryContainer,
)),
Expand Down
1 change: 0 additions & 1 deletion lib/channels/views/tv/screens/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class TvChannelScreen extends StatelessWidget {
'',
width: 70,
height: 70,
id: 'author-big-${channel.channel?.authorId}',
decoration:
BoxDecoration(borderRadius: BorderRadius.circular(35)),
),
Expand Down
1 change: 0 additions & 1 deletion lib/comments/views/components/comment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class SingleCommentView extends StatelessWidget {
child: Thumbnail(
width: 20,
height: 20,
id: 'comment-author-${_.comment.authorId}',
thumbnailUrl: ImageObject.getBestThumbnail(_.comment.authorThumbnails)?.url ?? '',
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20)),
),
Expand Down
26 changes: 15 additions & 11 deletions lib/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:invidious/search/models/db/searchHistoryItem.dart';
import 'package:invidious/settings/models/db/settings.dart';
import 'package:invidious/settings/models/errors/noServerSelected.dart';
import 'package:invidious/settings/states/settings.dart';
import 'package:invidious/videos/models/db/dearrow_cache.dart';
import 'package:invidious/videos/models/db/history_video_cache.dart';
import 'package:invidious/videos/models/db/progress.dart';
import 'package:logging/logging.dart';
Expand Down Expand Up @@ -50,8 +51,10 @@ const NAVIGATION_BAR_LABEL_BEHAVIOR = 'navigation-bar-label-behavior';
const DISTRACTION_FREE_MODE = 'distraction-free-mode';
const BACKGROUND_NOTIFICATIONS = 'background-notifications';
const SUBSCRIPTION_NOTIFICATIONS = 'subscriptions-notifications';
const BACKGROUND_CHECK_FREQUENCY = "background-check-frequency";
const BACKGROUND_CHECK_FREQUENCY = "background-check-frequency";
const SUBTITLE_BACKGROUND = 'subtitle-background';
const DEARROW = 'dearrow';
const DEARROW_THUMBNAILS = "dearrow-thumbnails";

const ON_OPEN = "on-open";

Expand Down Expand Up @@ -149,8 +152,7 @@ class DbClient {

bool isLoggedInToCurrentServer() {
var currentlySelectedServer = getCurrentlySelectedServer();
return (currentlySelectedServer.authToken?.isNotEmpty ?? false) ||
(currentlySelectedServer.sidCookie?.isNotEmpty ?? false);
return (currentlySelectedServer.authToken?.isNotEmpty ?? false) || (currentlySelectedServer.sidCookie?.isNotEmpty ?? false);
}

double getVideoProgress(String videoId) {
Expand Down Expand Up @@ -179,9 +181,7 @@ class DbClient {
}

List<SearchHistoryItem> _getSearchHistory() {
return (store.box<SearchHistoryItem>().query()..order(SearchHistoryItem_.time, flags: Order.descending))
.build()
.find();
return (store.box<SearchHistoryItem>().query()..order(SearchHistoryItem_.time, flags: Order.descending)).build().find();
}

void addToSearchHistory(SearchHistoryItem searchHistoryItem) {
Expand Down Expand Up @@ -305,11 +305,7 @@ class DbClient {
}

PlaylistNotification? getPlaylistNotification(String channelId) {
return store
.box<PlaylistNotification>()
.query(PlaylistNotification_.playlistId.equals(channelId))
.build()
.findFirst();
return store.box<PlaylistNotification>().query(PlaylistNotification_.playlistId.equals(channelId)).build().findFirst();
}

List<PlaylistNotification> getAllPlaylistNotifications() {
Expand All @@ -332,4 +328,12 @@ class DbClient {
upsertPlaylistNotification(notif);
}
}

DeArrowCache? getDeArrowCache(String videoId) {
return store.box<DeArrowCache>().query(DeArrowCache_.videoId.equals(videoId)).build().findFirst();
}

void upsertDeArrowCache(DeArrowCache cache) {
store.box<DeArrowCache>().put(cache);
}
}
20 changes: 20 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1176,5 +1176,25 @@
"history": "History",
"@history": {
"description": "User view history label"
},
"deArrowSettingDescription": "Replace click bait titles and thumbnails",
"@deArrowSettingDescription": {
"description": "Description for dearrow"
},
"deArrowReplaceThumbnails": "Replace thumbnails",
"@deArrowReplaceThumbnails": {
"description": "Settings title for checkbox on whether the thumbnail should be replaced as well"
},
"deArrowReplaceThumbnailsDescription": "Replace video thumbnails in addition of the titles",
"@deArrowReplaceThumbnailsDescription": {
"description": "Description for DeArrow setting switch"
},
"deArrowWarning": "Enable DeArrow can signgificantly reduce the browsing speed of the app as extra http requests are needed for every single video",
"@deArrowWarning": {
"description": "Warning message when the user enables DeArrow"
},
"enabled": "Enabled",
"@enabled": {
"description": "Text to show something is enabled"
}
}
41 changes: 37 additions & 4 deletions lib/objectbox-model.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,16 +437,48 @@
}
],
"relations": []
},
{
"id": "15:7475761865024216578",
"lastPropertyId": "4:7876161971726247302",
"name": "DeArrowCache",
"properties": [
{
"id": "1:2266267358862097191",
"name": "id",
"type": 6,
"flags": 1
},
{
"id": "2:6260864673962012294",
"name": "videoId",
"type": 9,
"flags": 34848,
"indexId": "8:11015011236117301"
},
{
"id": "3:3037776482306894529",
"name": "title",
"type": 9
},
{
"id": "4:7876161971726247302",
"name": "url",
"type": 9
}
],
"relations": []
}
],
"lastEntityId": "13:8331886434292283747",
"lastIndexId": "7:4488140487903335246",
"lastEntityId": "15:7475761865024216578",
"lastIndexId": "8:11015011236117301",
"lastRelationId": "0:0",
"lastSequenceId": "0:0",
"modelVersion": 5,
"modelVersionParserMinimum": 5,
"retiredEntityUids": [
6897417709810972885
6897417709810972885,
2895109148053406327
],
"retiredIndexUids": [
9110274326691932798
Expand All @@ -457,7 +489,8 @@
7030952573865954657,
6600296338817128660,
345286493546760360,
3278768646220204892
3278768646220204892,
6911432365687480646
],
"retiredRelationUids": [],
"version": 1
Expand Down
95 changes: 91 additions & 4 deletions lib/objectbox.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions lib/player/states/player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ class PlayerCubit extends Cubit<PlayerState> {
);
BackButtonInterceptor.add(handleBackButton, name: 'miniPlayer', zIndex: 2, ifNotYetIntercepted: true);
} else if (isTv && state.videos.isNotEmpty) {
switchToVideo(state.videos[0]);
await switchToVideo(state.videos[0]);
generatePlayQueue();
}
}

Expand Down Expand Up @@ -317,7 +318,7 @@ class PlayerCubit extends Cubit<PlayerState> {
}

playNext() {
EasyThrottle.throttle(skipToVideoThrottleName, Duration(seconds: 1), () async {
EasyThrottle.throttle(skipToVideoThrottleName, const Duration(seconds: 1), () async {
if (settings.state.playerRepeatMode == PlayerRepeat.repeatOne) {
seek(Duration.zero);
play();
Expand Down
14 changes: 5 additions & 9 deletions lib/player/views/components/audio_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@ class AudioPlayer extends StatelessWidget {
final DownloadedVideo? offlineVideo;
final bool miniPlayer;

const AudioPlayer({super.key, this.video, required this.miniPlayer, this.offlineVideo})
: assert(video == null || offlineVideo == null, 'cannot provide both video and offline video\n');
const AudioPlayer({super.key, this.video, required this.miniPlayer, this.offlineVideo}) : assert(video == null || offlineVideo == null, 'cannot provide both video and offline video\n');

@override
Widget build(BuildContext context) {
var player = context.read<PlayerCubit>();
var settings = context.read<SettingsCubit>();

return BlocProvider(
create: (context) =>
AudioPlayerCubit(AudioPlayerState(offlineVideo: offlineVideo, video: video), player, settings),
create: (context) => AudioPlayerCubit(AudioPlayerState(offlineVideo: offlineVideo, video: video), player, settings),
child: BlocBuilder<AudioPlayerCubit, AudioPlayerState>(
builder: (context, _) => BlocListener<PlayerCubit, PlayerState>(
listenWhen: (previous, current) =>
previous.mediaCommand != current.mediaCommand && current.mediaCommand != null,
listenWhen: (previous, current) => previous.mediaCommand != current.mediaCommand && current.mediaCommand != null,
listener: (context, state) => context.read<AudioPlayerCubit>().handleCommand(state.mediaCommand!),
child: Padding(
padding: EdgeInsets.all(miniPlayer ? 8 : 0.0),
Expand All @@ -40,11 +37,10 @@ class AudioPlayer extends StatelessWidget {
? VideoThumbnailView(
decoration: const BoxDecoration(),
videoId: _.video!.videoId,
thumbnailUrl: _.video?.getBestThumbnail()?.url ?? '',
thumbnailUrl: _.video?.deArrowThumbnailUrl ?? _.video?.getBestThumbnail()?.url ?? '',
)
: _.offlineVideo != null
? OfflineVideoThumbnail(
borderRadius: 0, key: ValueKey(_.offlineVideo?.videoId ?? ''), video: _.offlineVideo!)
? OfflineVideoThumbnail(borderRadius: 0, key: ValueKey(_.offlineVideo?.videoId ?? ''), video: _.offlineVideo!)
: const SizedBox.shrink(),
PlayerControls(mediaPlayerCubit: context.read<AudioPlayerCubit>())
],
Expand Down
Loading