Source Code#
Our source code is documented using the standard documentation guidelines.
Source#
- class Jellyfin.Plugin.Themerr.Configuration.PluginConfiguration : BasePluginConfiguration#
Inheritence diagram for Jellyfin::Plugin::Themerr::Configuration::PluginConfiguration:
Collaboration diagram for Jellyfin::Plugin::Themerr::Configuration::PluginConfiguration:
Initializes a new instance of the PluginConfiguration class.
Public Functions
- PluginConfiguration ()#
Initializes a new instance of the PluginConfiguration class.
Properties
- int? UpdateInterval { get; set; }#
Gets or sets the time between scheduled updates, in minutes.
Minimum value of 15.
Private Members
- int _updateInterval#
- class Jellyfin.Plugin.Themerr.Api.ThemerrController : ControllerBase#
Inheritence diagram for Jellyfin::Plugin::Themerr::Api::ThemerrController:
Collaboration diagram for Jellyfin::Plugin::Themerr::Api::ThemerrController:
The Themerr api controller.
Public Functions
- List<string> GetCultureResource (string culture)#
Get the resources of the given culture.
- Param culture:
The culture to get the resource for.
- Return:
A list of file names.
- ActionResult GetProgress ()#
Get the data required to populate the progress dashboard.
Loop over all Jellyfin libraries and supported items, creating a json object with the following structure: { “items”: [BaseItems], “media_count”: BaseItems.Count, “media_percent_complete”: ThemedItems.Count / BaseItems.Count * 100, }
- Return:
JSON object containing progress data.
- ActionResult GetTranslations ()#
Get the localization strings from Locale/{selected_locale}.json.
- Return:
JSON object containing localization strings.
- ThemerrController (ILibraryManager libraryManager, ILogger<ThemerrController> logger, IServerConfigurationManager configurationManager, ILoggerFactory loggerFactory)#
Initializes a new instance of the ThemerrController class.
- Param libraryManager:
The library manager.
- Param logger:
The logger.
- Param configurationManager:
The configuration manager.
- Param loggerFactory:
The logger factory.
Private Members
- readonly IServerConfigurationManager _configurationManager#
- readonly ILogger<ThemerrController> _logger#
- readonly ThemerrManager _themerrManager#
- class Jellyfin.Plugin.Themerr.ThemerrManager : IServerEntryPoint#
Inheritence diagram for Jellyfin::Plugin::Themerr::ThemerrManager:
Collaboration diagram for Jellyfin::Plugin::Themerr::ThemerrManager:
The main entry point for the plugin.
Public Functions
- bool ContinueDownload (string themePath, string themerrDataPath)#
Check if the theme song should be downloaded.
Various checks are performed to determine if the theme song should be downloaded.
- Param themePath:
The path to the theme song.
- Param themerrDataPath:
The path to the themerr data file.
- Return:
True to continue with downloaded, false otherwise.
- string CreateThemerrDbLink (string tmdbId, string dbType)#
Create a link to the themerr database.
- Param tmdbId:
The tmdb id.
- Param dbType:
The database type.
- Return:
The themerr database link.
- void Dispose ()#
Cleanup.
- string GetExistingThemerrDataValue (string key, string themerrDataPath)#
Get a value from the themerr data file if it exists.
- Param key:
The key to search for.
- Param themerrDataPath:
The path to the themerr data file.
- Return:
The value of the key if it exists, null otherwise.
- string GetIssueUrl (BaseItem item)#
Get ThemerrDB issue url.
This url can be used to easily add/edit theme songs in ThemerrDB.
- Param item:
The Jellyfin media object.
- Return:
The ThemerrDB issue url.
- string GetMd5Hash (string filePath)#
Get the MD5 hash of a file.
- Param filePath:
The file path.
- Return:
The MD5 hash of the file.
- string GetThemePath (BaseItem item)#
Get the path to the theme song.
- Param item:
The Jellyfin media object.
- Return:
The path to the theme song.
- string GetThemeProvider (BaseItem item)#
Get the theme provider.
- Param item:
The Jellyfin media object.
- Return:
The theme provider.
- string GetThemerrDataPath (BaseItem item)#
Get the path to the themerr data file.
- Param item:
The Jellyfin media object.
- Return:
The path to the themerr data file.
- string GetTmdbId (BaseItem item)#
Get TMDB id from an item.
- Param item:
The Jellyfin media object.
- Return:
TMDB id.
- IEnumerable<BaseItem> GetTmdbItemsFromLibrary ()#
Get all supported items from the library that have a tmdb id.
- Return:
List of BaseItem objects.
- string GetYoutubeThemeUrl (string themerrDbUrl, BaseItem item)#
Get the YouTube theme url from the themerr database.
- Param themerrDbUrl:
The themerr database url.
- Param item:
The Jellyfin media object.
- Return:
The YouTube theme url.
- void ProcessItemTheme (BaseItem item)#
Download the theme song for a media item if it doesn’t already exist.
- Param item:
The Jellyfin media object.
- Task RunAsync ()#
Run the task, asynchronously.
- Return:
A Task representing the asynchronous operation.
- bool SaveMp3 (string destination, string videoUrl)#
Save a mp3 file from a youtube video url.
- Param destination:
The destination path.
- Param videoUrl:
The YouTube video url.
- Return:
True if the file was saved successfully, false otherwise.
- bool SaveThemerrData (string themePath, string themerrDataPath, string youtubeThemeUrl)#
Save the themerr data file.
- Param themePath:
The path to the theme song.
- Param themerrDataPath:
The path to the themerr data file.
- Param youtubeThemeUrl:
The YouTube theme url.
- Return:
True if the file was saved successfully, false otherwise.
- ThemerrManager (ILibraryManager libraryManager, ILogger<ThemerrManager> logger)#
Initializes a new instance of the ThemerrManager class.
- Param libraryManager:
The library manager.
- Param logger:
The logger.
- Task UpdateAll ()#
Enumerate through all supported items in the library and downloads their theme songs as required.
- Return:
A Task representing the asynchronous operation.
- bool WaitForFile (string filePath, int timeout)#
Wait for file to exist on disk and is not locked by another process.
- Param filePath:
The file path to check.
- Param timeout:
The maximum amount of time (in milliseconds) to wait.
- Return:
True if the file exists and is not locked, false otherwise.
Private Functions
- void OnTimerElapsed ()#
Called when the plugin is loaded.
- class Jellyfin.Plugin.Themerr.ThemerrPlugin : BasePlugin<PluginConfiguration>, IHasWebPages#
Inheritence diagram for Jellyfin::Plugin::Themerr::ThemerrPlugin:
Collaboration diagram for Jellyfin::Plugin::Themerr::ThemerrPlugin:
The Themerr plugin class.
Public Functions
- IEnumerable<PluginPageInfo> GetPages ()#
Get the plugin’s html config page.
- Return:
Instance of the PluginPageInfo configuration page.
- ThemerrPlugin (IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)#
Initializes a new instance of the ThemerrPlugin class.
- Param applicationPaths:
Instance of the IApplicationPaths interface.
- Param xmlSerializer:
Instance of the IXmlSerializer interface.
Properties
- override string Description { get; set; }#
Gets the description of the plugin.
- ThemerrPlugin Instance { get; set; }#
Gets the plugin instance.
- override string Name { get; set; }#
Gets the name of the plugin.
- class Jellyfin.Plugin.Themerr.ScheduledTasks.ThemerrTasks : IScheduledTask#
Inheritence diagram for Jellyfin::Plugin::Themerr::ScheduledTasks::ThemerrTasks:
Collaboration diagram for Jellyfin::Plugin::Themerr::ScheduledTasks::ThemerrTasks:
The Themerr scheduled task.
Public Functions
- async Task ExecuteAsync (IProgress<double> progress, CancellationToken cancellationToken)#
Execute the task, asynchronously.
- Param progress:
The progress reporter.
- Param cancellationToken:
The cancellation token.
- Return:
A Task representing the asynchronous operation.
- IEnumerable<TaskTriggerInfo> GetDefaultTriggers ()#
Gets the default triggers.
- Return:
A list of TaskTriggerInfo.
- ThemerrTasks (ILibraryManager libraryManager, ILogger<ThemerrTasks> logger, ILoggerFactory loggerFactory)#
Initializes a new instance of the ThemerrTasks class.
- Param libraryManager:
The library manager.
- Param logger:
The logger.
- Param loggerFactory:
The logger factory.
- namespace Jellyfin#
- namespace Jellyfin.Data.Enums#
- namespace Jellyfin.Plugin#
- namespace Jellyfin.Plugin.Themerr#
- namespace Jellyfin.Plugin.Themerr.Api#
- namespace Jellyfin.Plugin.Themerr.Configuration#
- namespace Jellyfin.Plugin.Themerr.ScheduledTasks#
- namespace MediaBrowser.Common.Configuration#
- namespace MediaBrowser.Common.Plugins#
- namespace MediaBrowser.Controller.Configuration#
- namespace MediaBrowser.Controller.Entities#
- namespace MediaBrowser.Controller.Entities.Movies#
- namespace MediaBrowser.Controller.Entities.TV#
- namespace MediaBrowser.Controller.Library#
- namespace MediaBrowser.Controller.Plugins#
- namespace MediaBrowser.Model.Entities#
- namespace MediaBrowser.Model.Plugins#
- namespace MediaBrowser.Model.Serialization#
- namespace MediaBrowser.Model.Tasks#
- namespace Microsoft.AspNetCore.Authorization#
- namespace Microsoft.AspNetCore.Http#
- namespace Microsoft.AspNetCore.Mvc#
- namespace Microsoft.Extensions.Logging#
- namespace Newtonsoft.Json#
- namespace System#
- namespace System.Collections#
- namespace System.Collections.Generic#
- namespace System.IO#
- namespace System.Linq#
- namespace System.Net.Http#
- namespace System.Net.Mime#
- namespace System.Reflection#
- namespace System.Threading#
- namespace System.Threading.Tasks#
- namespace YoutubeExplode#
- namespace YoutubeExplode.Videos.Streams#
- file ThemerrController.cs
- file PluginConfiguration.cs
- file ThemerrTasks.cs
- file ThemerrManager.cs
- file ThemerrPlugin.cs
- dir Jellyfin.Plugin.Themerr/Api
- dir Jellyfin.Plugin.Themerr/Configuration
- dir Jellyfin.Plugin.Themerr
- dir Jellyfin.Plugin.Themerr/ScheduledTasks