mirror of
https://github.com/memen45/SubMusic.git
synced 2026-02-18 00:57:39 +01:00
Version [0.0.16] - 2020-10-08
- added support for d2 delta series and Venu Mercedes-Benz Collection
- fixed null handling (Nextcloud + SMB storage bug)
- fixed incorrect progressbar
- upgrade to storage, requires resync (no reinstall needed)
- improved speed of playback selection
- fixes syncing playlist metadata in background
- fixed managing playlists that are no longer online ('local only')
- fixed marking of incompletely synced playlist ('needs sync')
- added support for adts, wav, mp4 file types (defaults to mp3)
83 lines
2.4 KiB
MonkeyC
83 lines
2.4 KiB
MonkeyC
using Toybox.Application;
|
|
using Toybox.WatchUi;
|
|
|
|
class SubMusicApp extends Application.AudioContentProviderApp {
|
|
|
|
private var d_provider = null;
|
|
|
|
function initialize() {
|
|
AudioContentProviderApp.initialize();
|
|
|
|
// in case variables need to be reset
|
|
// Application.Storage.clearValues();
|
|
|
|
// perform storage check and fix if possible
|
|
Storage.check();
|
|
}
|
|
|
|
// onStart() is called on application start up
|
|
function onStart(state) {
|
|
}
|
|
|
|
// onStop() is called when your application is exiting
|
|
function onStop(state) {
|
|
}
|
|
|
|
function onSettingsChanged() {
|
|
System.println("Settings changed");
|
|
|
|
// reset the sessions for the provider
|
|
if (d_provider == null) {
|
|
return;
|
|
}
|
|
d_provider.onSettingsChanged(getProviderSettings());
|
|
}
|
|
|
|
// Get a Media.ContentDelegate for use by the system to get and iterate through media on the device
|
|
function getContentDelegate(arg) {
|
|
return new SubMusicContentDelegate();
|
|
}
|
|
|
|
// Get a delegate that communicates sync status to the system for syncing media content to the device
|
|
function getSyncDelegate() {
|
|
// create provider if not yet available
|
|
if (d_provider == null) {
|
|
d_provider = providerFactory();
|
|
}
|
|
return new SubMusicSyncDelegate(d_provider);
|
|
}
|
|
|
|
// Get the initial view for configuring playback
|
|
function getPlaybackConfigurationView() {
|
|
return [ new SubMusicConfigurePlaybackView(), new WatchUi.BehaviorDelegate() ];
|
|
}
|
|
|
|
// Get the initial view for configuring sync
|
|
function getSyncConfigurationView() {
|
|
// create provider if not yet available
|
|
if (d_provider == null) {
|
|
d_provider = providerFactory();
|
|
}
|
|
return [ new SubMusicConfigureSyncView(), new SubMusicConfigureSyncDelegate(d_provider) ];
|
|
}
|
|
|
|
function getProviderSettings() {
|
|
return {
|
|
"api_url" => Application.Properties.getValue("subsonic_API_URL"),
|
|
"api_usr" => Application.Properties.getValue("subsonic_API_usr"),
|
|
"api_key" => Application.Properties.getValue("subsonic_API_key"),
|
|
};
|
|
}
|
|
|
|
function providerFactory() {
|
|
// construct the selected provider
|
|
var settings = getProviderSettings();
|
|
|
|
var type = Application.Properties.getValue("API_standard");
|
|
if (type == ApiStandard.AMPACHE) {
|
|
return new AmpacheProvider(settings);
|
|
}
|
|
return new SubsonicProvider(settings);
|
|
}
|
|
}
|