mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-08-22 10:09:39 +00:00
Update Extractor and add migration to remove SoundCloud Top 50 kiosk
This commit is contained in:
parent
938265d127
commit
7e0ee4eb7a
@ -214,7 +214,7 @@ dependencies {
|
|||||||
// the corresponding commit hash, since JitPack sometimes deletes artifacts.
|
// the corresponding commit hash, since JitPack sometimes deletes artifacts.
|
||||||
// If there’s already a git hash, just add more of it to the end (or remove a letter)
|
// If there’s already a git hash, just add more of it to the end (or remove a letter)
|
||||||
// to cause jitpack to regenerate the artifact.
|
// to cause jitpack to regenerate the artifact.
|
||||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:68b4c9acbae2d167e7b1209bb6bf0ae086dd427e'
|
implementation 'com.github.TeamNewPipe:NewPipeExtractor:7adbc48a0aa872c016b8ec089e278d5e12772054'
|
||||||
implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'
|
implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'
|
||||||
|
|
||||||
/** Checkstyle **/
|
/** Checkstyle **/
|
||||||
|
@ -12,13 +12,19 @@ import org.schabi.newpipe.R;
|
|||||||
import org.schabi.newpipe.error.ErrorInfo;
|
import org.schabi.newpipe.error.ErrorInfo;
|
||||||
import org.schabi.newpipe.error.ErrorUtil;
|
import org.schabi.newpipe.error.ErrorUtil;
|
||||||
import org.schabi.newpipe.error.UserAction;
|
import org.schabi.newpipe.error.UserAction;
|
||||||
|
import org.schabi.newpipe.extractor.ServiceList;
|
||||||
|
import org.schabi.newpipe.settings.tabs.Tab;
|
||||||
|
import org.schabi.newpipe.settings.tabs.TabsManager;
|
||||||
import org.schabi.newpipe.util.DeviceUtils;
|
import org.schabi.newpipe.util.DeviceUtils;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.schabi.newpipe.MainActivity.DEBUG;
|
import static org.schabi.newpipe.MainActivity.DEBUG;
|
||||||
|
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In order to add a migration, follow these steps, given P is the previous version:<br>
|
* In order to add a migration, follow these steps, given P is the previous version:<br>
|
||||||
@ -129,7 +135,7 @@ public final class SettingMigrations {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Migration MIGRATION_5_6 = new Migration(5, 6) {
|
private static final Migration MIGRATION_5_6 = new Migration(5, 6) {
|
||||||
@Override
|
@Override
|
||||||
protected void migrate(@NonNull final Context context) {
|
protected void migrate(@NonNull final Context context) {
|
||||||
final boolean loadImages = sp.getBoolean("download_thumbnail_key", true);
|
final boolean loadImages = sp.getBoolean("download_thumbnail_key", true);
|
||||||
@ -143,6 +149,24 @@ public final class SettingMigrations {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static final Migration MIGRATION_6_7 = new Migration(6, 7) {
|
||||||
|
@Override
|
||||||
|
protected void migrate(@NonNull final Context context) {
|
||||||
|
// The SoundCloud Top 50 Kiosk was removed in the extractor,
|
||||||
|
// so we remove the corresponding tab if it exists.
|
||||||
|
final TabsManager tabsManager = TabsManager.getManager(context);
|
||||||
|
final List<Tab> tabs = tabsManager.getTabs();
|
||||||
|
final List<Tab> cleanedTabs = tabs.stream()
|
||||||
|
.filter(tab -> !(tab instanceof Tab.KioskTab kioskTab
|
||||||
|
&& kioskTab.getKioskServiceId() == SoundCloud.getServiceId()
|
||||||
|
&& kioskTab.getKioskId().equals("Top 50")))
|
||||||
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
if (tabs.size() != cleanedTabs.size()) {
|
||||||
|
tabsManager.saveTabs(cleanedTabs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of all implemented migrations.
|
* List of all implemented migrations.
|
||||||
* <p>
|
* <p>
|
||||||
@ -156,12 +180,13 @@ public final class SettingMigrations {
|
|||||||
MIGRATION_3_4,
|
MIGRATION_3_4,
|
||||||
MIGRATION_4_5,
|
MIGRATION_4_5,
|
||||||
MIGRATION_5_6,
|
MIGRATION_5_6,
|
||||||
|
MIGRATION_6_7
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version number for preferences. Must be incremented every time a migration is necessary.
|
* Version number for preferences. Must be incremented every time a migration is necessary.
|
||||||
*/
|
*/
|
||||||
private static final int VERSION = 6;
|
private static final int VERSION = 7;
|
||||||
|
|
||||||
|
|
||||||
public static void runMigrationsIfNeeded(@NonNull final Context context) {
|
public static void runMigrationsIfNeeded(@NonNull final Context context) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user