Merge pull request #183 from MDP43140/filler-category

Add Filler category
This commit is contained in:
poly 2022-07-09 11:06:04 -06:00 committed by GitHub
commit 0aaaf432bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 57 additions and 0 deletions

View file

@ -321,6 +321,10 @@ public class LocalPlayer implements com.google.android.exoplayer2.Player.Listene
toastText = context toastText = context
.getString(R.string.sponsor_block_skip_non_music_toast); .getString(R.string.sponsor_block_skip_non_music_toast);
break; break;
case "filler":
toastText = context
.getString(R.string.sponsor_block_skip_filler_toast);
break;
} }
Toast.makeText(context, toastText, Toast.LENGTH_SHORT).show(); Toast.makeText(context, toastText, Toast.LENGTH_SHORT).show();

View file

@ -1839,6 +1839,10 @@ public final class Player implements
toastText = context toastText = context
.getString(R.string.sponsor_block_skip_non_music_toast); .getString(R.string.sponsor_block_skip_non_music_toast);
break; break;
case "filler":
toastText = context
.getString(R.string.sponsor_block_skip_filler_toast);
break;
} }
Toast.makeText(context, toastText, Toast.LENGTH_SHORT).show(); Toast.makeText(context, toastText, Toast.LENGTH_SHORT).show();

View file

@ -58,6 +58,10 @@ public class SponsorBlockCategoriesSettingsFragment extends BasePreferenceFragme
R.string.sponsor_block_category_non_music_color_key, R.string.sponsor_block_category_non_music_color_key,
R.color.non_music_segment); R.color.non_music_segment);
setColorPreference(editor,
R.string.sponsor_block_category_filler_color_key,
R.color.filler_segment);
editor.apply(); editor.apply();
Toast.makeText(p.getContext(), R.string.sponsor_block_reset_colors_toast, Toast.makeText(p.getContext(), R.string.sponsor_block_reset_colors_toast,

View file

@ -71,6 +71,8 @@ public final class SponsorBlockUtils {
.getString(R.string.sponsor_block_category_self_promo_key), false); .getString(R.string.sponsor_block_category_self_promo_key), false);
final boolean includeMusicCategory = prefs.getBoolean(context final boolean includeMusicCategory = prefs.getBoolean(context
.getString(R.string.sponsor_block_category_non_music_key), false); .getString(R.string.sponsor_block_category_non_music_key), false);
final boolean includeFillerCategory = prefs.getBoolean(context
.getString(R.string.sponsor_block_category_filler_key), false);
final ArrayList<String> categoryParamList = new ArrayList<>(); final ArrayList<String> categoryParamList = new ArrayList<>();
@ -92,6 +94,9 @@ public final class SponsorBlockUtils {
if (includeMusicCategory) { if (includeMusicCategory) {
categoryParamList.add("music_offtopic"); categoryParamList.add("music_offtopic");
} }
if (includeFillerCategory) {
categoryParamList.add("filler");
}
if (categoryParamList.size() == 0) { if (categoryParamList.size() == 0) {
return null; return null;
@ -268,6 +273,16 @@ public final class SponsorBlockUtils {
: Color.parseColor(colorStr); : Color.parseColor(colorStr);
} }
break; break;
case "filler":
key = context.getString(R.string.sponsor_block_category_filler_key);
if (prefs.getBoolean(key, false)) {
key = context.getString(R.string.sponsor_block_category_filler_color_key);
colorStr = prefs.getString(key, null);
return colorStr == null
? context.getResources().getColor(R.color.filler_segment)
: Color.parseColor(colorStr);
}
break;
} }
return null; return null;

View file

@ -88,4 +88,5 @@
<color name="interaction_segment">#cc00ff</color> <color name="interaction_segment">#cc00ff</color>
<color name="self_promo_segment">#ffff00</color> <color name="self_promo_segment">#ffff00</color>
<color name="non_music_segment">#ff9900</color> <color name="non_music_segment">#ff9900</color>
<color name="filler_segment">#7300ff</color>
</resources> </resources>

View file

@ -428,6 +428,8 @@
<string name="sponsor_block_category_self_promo_color_key" translatable="false">sponsor_block_category_self_promo_color</string> <string name="sponsor_block_category_self_promo_color_key" translatable="false">sponsor_block_category_self_promo_color</string>
<string name="sponsor_block_category_non_music_key" translatable="false">sponsor_block_category_music</string> <string name="sponsor_block_category_non_music_key" translatable="false">sponsor_block_category_music</string>
<string name="sponsor_block_category_non_music_color_key" translatable="false">sponsor_block_category_music_color</string> <string name="sponsor_block_category_non_music_color_key" translatable="false">sponsor_block_category_music_color</string>
<string name="sponsor_block_category_filler_key" translatable="false">sponsor_block_category_filler</string>
<string name="sponsor_block_category_filler_color_key" translatable="false">sponsor_block_category_filler_color</string>
<string name="sponsor_block_whitelist_key" translatable="false">sponsor_block_whitelist</string> <string name="sponsor_block_whitelist_key" translatable="false">sponsor_block_whitelist</string>
<string name="sponsor_block_clear_whitelist_key" translatable="false">sponsor_block_clear_whitelist</string> <string name="sponsor_block_clear_whitelist_key" translatable="false">sponsor_block_clear_whitelist</string>

View file

@ -163,6 +163,8 @@
<string name="settings_category_sponsor_block_category_self_promo_summary">Similar to "sponsor" except for unpaid or self promotion. This includes sections about merchandise, donations, or information about who they collaborated with.</string> <string name="settings_category_sponsor_block_category_self_promo_summary">Similar to "sponsor" except for unpaid or self promotion. This includes sections about merchandise, donations, or information about who they collaborated with.</string>
<string name="settings_category_sponsor_block_category_non_music_title">Music: Non-Music Section</string> <string name="settings_category_sponsor_block_category_non_music_title">Music: Non-Music Section</string>
<string name="settings_category_sponsor_block_category_non_music_summary">Only for use in music videos. This includes introductions or outros in music videos.</string> <string name="settings_category_sponsor_block_category_non_music_summary">Only for use in music videos. This includes introductions or outros in music videos.</string>
<string name="settings_category_sponsor_block_category_filler_title">Filler Tangent/Jokes</string>
<string name="settings_category_sponsor_block_category_filler_summary">This is for tangential scenes added only for filler or humor that are not required to understand the main content of the video.</string>
<string name="background_player_playing_toast">Playing in background</string> <string name="background_player_playing_toast">Playing in background</string>
<string name="popup_playing_toast">Playing in popup mode</string> <string name="popup_playing_toast">Playing in popup mode</string>
<string name="content">Content</string> <string name="content">Content</string>
@ -792,6 +794,7 @@
<string name="sponsor_block_skip_interaction_toast">Skipped interaction reminder</string> <string name="sponsor_block_skip_interaction_toast">Skipped interaction reminder</string>
<string name="sponsor_block_skip_self_promo_toast">Skipped unpaid/self promo</string> <string name="sponsor_block_skip_self_promo_toast">Skipped unpaid/self promo</string>
<string name="sponsor_block_skip_non_music_toast">Skipped non-music</string> <string name="sponsor_block_skip_non_music_toast">Skipped non-music</string>
<string name="sponsor_block_skip_filler_toast">Skipped filler</string>
<string name="sponsor_block_toggle_skipping">Toggle skipping sponsors</string> <string name="sponsor_block_toggle_skipping">Toggle skipping sponsors</string>
<string name="sponsor_block_clear_whitelist_title">Clear Whitelist</string> <string name="sponsor_block_clear_whitelist_title">Clear Whitelist</string>
<string name="sponsor_block_clear_whitelist_summary">Clear the list of uploaders SponsorBlock will ignore.</string> <string name="sponsor_block_clear_whitelist_summary">Clear the list of uploaders SponsorBlock will ignore.</string>

View file

@ -148,6 +148,30 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory
android:layout="@layout/settings_category_header_layout"
android:title="@string/settings_category_sponsor_block_category_filler_title">
<Preference
app:iconSpaceReserved="false"
android:summary="@string/settings_category_sponsor_block_category_filler_summary"
android:selectable="false"/>
<SwitchPreference
app:iconSpaceReserved="false"
android:defaultValue="false"
android:key="@string/sponsor_block_category_filler_key"
android:title="@string/settings_category_sponsor_block_category_enable_title"/>
<org.schabi.newpipe.settings.custom.EditColorPreference
app:iconSpaceReserved="false"
android:dependency="@string/sponsor_block_category_filler_key"
android:defaultValue="@color/filler_segment"
android:key="@string/sponsor_block_category_filler_color_key"
android:title="@string/settings_category_sponsor_block_category_color"/>
</PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:layout="@layout/settings_category_header_layout"> android:layout="@layout/settings_category_header_layout">