diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 6e17172..0000000
--- a/.editorconfig
+++ /dev/null
@@ -1,207 +0,0 @@
-# With more recent updates Visual Studio 2017 supports EditorConfig files out of the box
-# Visual Studio Code needs an extension: https://github.com/editorconfig/editorconfig-vscode
-# For emacs, vim, np++ and other editors, see here: https://github.com/editorconfig
-###############################
-# Core EditorConfig Options #
-###############################
-root = true
-
-# All files
-[*]
-indent_style = space
-indent_size = 4
-charset = utf-8
-trim_trailing_whitespace = true
-insert_final_newline = true
-end_of_line = lf
-max_line_length = null
-
-# YAML indentation
-[*.{yml,yaml}]
-indent_size = 2
-
-# XML indentation
-[*.{csproj,xml}]
-indent_size = 2
-
-###############################
-# .NET Coding Conventions #
-###############################
-
-[*.{cs,vb}]
-# Organize usings
-dotnet_sort_system_directives_first = true
-# this. preferences
-dotnet_style_qualification_for_field = false:silent
-dotnet_style_qualification_for_property = false:silent
-dotnet_style_qualification_for_method = false:silent
-dotnet_style_qualification_for_event = false:silent
-# Language keywords vs BCL types preferences
-dotnet_style_predefined_type_for_locals_parameters_members = true:silent
-dotnet_style_predefined_type_for_member_access = true:silent
-# Parentheses preferences
-dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
-# Modifier preferences
-dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
-dotnet_style_readonly_field = true:suggestion
-# Expression-level preferences
-dotnet_style_object_initializer = true:suggestion
-dotnet_style_collection_initializer = true:suggestion
-dotnet_style_explicit_tuple_names = true:suggestion
-dotnet_style_null_propagation = true:suggestion
-dotnet_style_coalesce_expression = true:suggestion
-dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
-dotnet_prefer_inferred_tuple_names = true:suggestion
-dotnet_prefer_inferred_anonymous_type_member_names = true:suggestion
-dotnet_style_prefer_auto_properties = true:silent
-dotnet_style_prefer_conditional_expression_over_assignment = true:silent
-dotnet_style_prefer_conditional_expression_over_return = true:silent
-
-###############################
-# Naming Conventions #
-###############################
-
-# Style Definitions (From Roslyn)
-
-# Non-private static fields are PascalCase
-dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
-dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
-dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
-
-dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
-dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected internal, private protected
-dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
-
-dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
-
-# Constants are PascalCase
-dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
-dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
-dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
-
-dotnet_naming_symbols.constants.applicable_kinds = field, local
-dotnet_naming_symbols.constants.required_modifiers = const
-
-dotnet_naming_style.constant_style.capitalization = pascal_case
-
-# Static fields are camelCase and start with s_
-dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
-dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
-dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
-
-dotnet_naming_symbols.static_fields.applicable_kinds = field
-dotnet_naming_symbols.static_fields.required_modifiers = static
-
-dotnet_naming_style.static_field_style.capitalization = camel_case
-dotnet_naming_style.static_field_style.required_prefix = _
-
-# Instance fields are camelCase and start with _
-dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
-dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
-dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
-
-dotnet_naming_symbols.instance_fields.applicable_kinds = field
-
-dotnet_naming_style.instance_field_style.capitalization = camel_case
-dotnet_naming_style.instance_field_style.required_prefix = _
-
-# Locals and parameters are camelCase
-dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
-dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
-dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
-
-dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
-
-dotnet_naming_style.camel_case_style.capitalization = camel_case
-
-# Local functions are PascalCase
-dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
-dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
-dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
-
-dotnet_naming_symbols.local_functions.applicable_kinds = local_function
-
-dotnet_naming_style.local_function_style.capitalization = pascal_case
-
-# By default, name items with PascalCase
-dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
-dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
-dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
-
-dotnet_naming_symbols.all_members.applicable_kinds = *
-
-dotnet_naming_style.pascal_case_style.capitalization = pascal_case
-
-###############################
-# C# Coding Conventions #
-###############################
-
-[*.cs]
-# var preferences
-csharp_style_var_for_built_in_types = true:silent
-csharp_style_var_when_type_is_apparent = true:silent
-csharp_style_var_elsewhere = true:silent
-# Expression-bodied members
-csharp_style_expression_bodied_methods = false:silent
-csharp_style_expression_bodied_constructors = false:silent
-csharp_style_expression_bodied_operators = false:silent
-csharp_style_expression_bodied_properties = true:silent
-csharp_style_expression_bodied_indexers = true:silent
-csharp_style_expression_bodied_accessors = true:silent
-# Pattern matching preferences
-csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
-csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
-# Null-checking preferences
-csharp_style_throw_expression = true:suggestion
-csharp_style_conditional_delegate_call = true:suggestion
-# Modifier preferences
-csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
-# Expression-level preferences
-csharp_prefer_braces = true:silent
-csharp_style_deconstructed_variable_declaration = true:suggestion
-csharp_prefer_simple_default_expression = true:suggestion
-csharp_style_pattern_local_over_anonymous_function = true:suggestion
-csharp_style_inlined_variable_declaration = true:suggestion
-
-###############################
-# C# Formatting Rules #
-###############################
-
-# New line preferences
-csharp_new_line_before_open_brace = all
-csharp_new_line_before_else = true
-csharp_new_line_before_catch = true
-csharp_new_line_before_finally = true
-csharp_new_line_before_members_in_object_initializers = true
-csharp_new_line_before_members_in_anonymous_types = true
-csharp_new_line_between_query_expression_clauses = true
-# Indentation preferences
-csharp_indent_case_contents = true
-csharp_indent_switch_labels = true
-csharp_indent_labels = flush_left
-# Space preferences
-csharp_space_after_cast = false
-csharp_space_after_keywords_in_control_flow_statements = true
-csharp_space_between_method_call_parameter_list_parentheses = false
-csharp_space_between_method_declaration_parameter_list_parentheses = false
-csharp_space_between_parentheses = false
-csharp_space_before_colon_in_inheritance_clause = true
-csharp_space_after_colon_in_inheritance_clause = true
-csharp_space_around_binary_operators = before_and_after
-csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
-csharp_space_between_method_call_name_and_opening_parenthesis = false
-csharp_space_between_method_call_empty_parameter_list_parentheses = false
-# Wrapping preferences
-csharp_preserve_single_line_statements = true
-csharp_preserve_single_line_blocks = true
-
-###############################
-# VB Coding Conventions #
-###############################
-
-[*.vb]
-# Modifier preferences
-visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..14f691b
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,31 @@
+name: main
+on:
+ push:
+ branches:
+ - 'main'
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ dotnet-version: ['5.0.x' ]
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
+ uses: actions/setup-dotnet@v1.7.2
+ - name: Install dependencies
+ run: dotnet restore
+ - name: Build
+ run: dotnet build --configuration Release --no-restore
+ - name: copy assets
+ run: |
+ cp ./Jellyfin.Tmdb.Collections.Plugin/bin/Release/net5.0/Jellyfin.Tmdb.Collections.Plugin.dll .
+ - uses: "marvinpinto/action-automatic-releases@latest"
+ with:
+ repo_token: "${{ secrets.GITHUB_TOKEN }}"
+ automatic_release_tag: "latest"
+ prerelease: false
+ title: "latest"
+ files: |
+ Jellyfin.Tmdb.Collections.Plugin.dll
\ No newline at end of file
diff --git a/Jellyfin.Collections.Plugin/Configuration/PluginConfiguration.cs b/Jellyfin.Collections.Plugin/Configuration/PluginConfiguration.cs
deleted file mode 100644
index eda5df1..0000000
--- a/Jellyfin.Collections.Plugin/Configuration/PluginConfiguration.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using MediaBrowser.Model.Plugins;
-
-namespace Jellyfin.Collections.Plugin.Configuration
-{
- public enum SomeOptions
- {
- OneOption,
- AnotherOption
- }
-
- public class PluginConfiguration : BasePluginConfiguration
- {
- // store configurable settings your plugin might need
- public bool TrueFalseSetting { get; set; }
- public int AnInteger { get; set; }
- public string AString { get; set; }
- public SomeOptions Options { get; set; }
-
- public PluginConfiguration()
- {
- // set default options here
- Options = SomeOptions.AnotherOption;
- TrueFalseSetting = true;
- AnInteger = 2;
- AString = "string";
- }
- }
-}
diff --git a/Jellyfin.Collections.Plugin/Configuration/configPage.html b/Jellyfin.Collections.Plugin/Configuration/configPage.html
deleted file mode 100644
index 02d1d8a..0000000
--- a/Jellyfin.Collections.Plugin/Configuration/configPage.html
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
- Template
-
-
-
-
-
diff --git a/Jellyfin.Collections.Plugin.sln b/Jellyfin.Tmdb.Collections.Plugin.sln
similarity index 76%
rename from Jellyfin.Collections.Plugin.sln
rename to Jellyfin.Tmdb.Collections.Plugin.sln
index f633b19..6ea6b36 100644
--- a/Jellyfin.Collections.Plugin.sln
+++ b/Jellyfin.Tmdb.Collections.Plugin.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Plugin.Template", "Jellyfin.Collections.Plugin\Jellyfin.Collections.Plugin.csproj", "{D921B930-CF91-406F-ACBC-08914DCD0D34}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Tmdb.Collections.Plugin", "Jellyfin.Tmdb.Collections.Plugin\Jellyfin.Tmdb.Collections.Plugin.csproj", "{D921B930-CF91-406F-ACBC-08914DCD0D34}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/Jellyfin.Tmdb.Collections.Plugin/Configuration/PluginConfiguration.cs b/Jellyfin.Tmdb.Collections.Plugin/Configuration/PluginConfiguration.cs
new file mode 100644
index 0000000..e74bdfd
--- /dev/null
+++ b/Jellyfin.Tmdb.Collections.Plugin/Configuration/PluginConfiguration.cs
@@ -0,0 +1,16 @@
+using MediaBrowser.Model.Plugins;
+
+namespace Jellyfin.Tv.Network.Collections.Plugin.Configuration
+{
+
+ public class PluginConfiguration : BasePluginConfiguration
+ {
+ public string TmdbNetworks { get; set; }
+
+ public PluginConfiguration()
+ {
+ // set default options here
+ TmdbNetworks = "";
+ }
+ }
+}
diff --git a/Jellyfin.Tmdb.Collections.Plugin/Configuration/configPage.html b/Jellyfin.Tmdb.Collections.Plugin/Configuration/configPage.html
new file mode 100644
index 0000000..24e3536
--- /dev/null
+++ b/Jellyfin.Tmdb.Collections.Plugin/Configuration/configPage.html
@@ -0,0 +1,51 @@
+
+
+
+
+ Template
+
+
+
+
+
diff --git a/Jellyfin.Collections.Plugin/Jellyfin.Collections.Plugin.csproj b/Jellyfin.Tmdb.Collections.Plugin/Jellyfin.Tmdb.Collections.Plugin.csproj
similarity index 73%
rename from Jellyfin.Collections.Plugin/Jellyfin.Collections.Plugin.csproj
rename to Jellyfin.Tmdb.Collections.Plugin/Jellyfin.Tmdb.Collections.Plugin.csproj
index b856844..25ced46 100644
--- a/Jellyfin.Collections.Plugin/Jellyfin.Collections.Plugin.csproj
+++ b/Jellyfin.Tmdb.Collections.Plugin/Jellyfin.Tmdb.Collections.Plugin.csproj
@@ -1,8 +1,8 @@
- netstandard2.1
- Jellyfin.Collections.Plugin
+ net5.0
+ Jellyfin.Tmdb.Collections.Plugin
1.0.0.0
1.0.0.0
@@ -10,6 +10,7 @@
+
diff --git a/Jellyfin.Collections.Plugin/Plugin.cs b/Jellyfin.Tmdb.Collections.Plugin/Plugin.cs
similarity index 76%
rename from Jellyfin.Collections.Plugin/Plugin.cs
rename to Jellyfin.Tmdb.Collections.Plugin/Plugin.cs
index 77f6f48..eb37341 100644
--- a/Jellyfin.Collections.Plugin/Plugin.cs
+++ b/Jellyfin.Tmdb.Collections.Plugin/Plugin.cs
@@ -1,18 +1,18 @@
using System;
using System.Collections.Generic;
-using Jellyfin.Plugin.Template.Configuration;
+using Jellyfin.Tv.Network.Collections.Plugin.Configuration;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization;
-namespace Jellyfin.Collections.Plugin
+namespace Jellyfin.Tv.Network.Collections.Plugin
{
public class Plugin : BasePlugin, IHasWebPages
{
- public override string Name => "Collections Generator";
+ public override string Name => "TMDB Network Collections Generator";
- public override Guid Id => Guid.Parse("ex5d7894-8eef-4b36-aa6f-5d124e828ce1");
+ public override Guid Id => Guid.Parse("3dbfb2cc-3c87-4e82-acf4-a2e6a77eace7");
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer)
{
diff --git a/Jellyfin.Tmdb.Collections.Plugin/TmdbNetworkCollectionsGenerator.cs b/Jellyfin.Tmdb.Collections.Plugin/TmdbNetworkCollectionsGenerator.cs
new file mode 100644
index 0000000..9ae4585
--- /dev/null
+++ b/Jellyfin.Tmdb.Collections.Plugin/TmdbNetworkCollectionsGenerator.cs
@@ -0,0 +1,183 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Threading;
+using System.Threading.Tasks;
+using Jellyfin.Tv.Network.Collections.Plugin;
+using MediaBrowser.Controller.Collections;
+using MediaBrowser.Controller.Entities.Movies;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Model.Tasks;
+using Microsoft.Extensions.Logging;
+using TMDbLib.Client;
+using TMDbLib.Objects.General;
+using TMDbLib.Objects.TvShows;
+
+namespace Emby.Server.Implementations.ScheduledTasks.Tasks
+{
+ ///
+ /// Generates Collections for shows based on TMDB networks.
+ ///
+ public class TmdbNetworkCollectionsGenerator : IScheduledTask, IConfigurableScheduledTask
+ {
+ private readonly ILibraryManager _libraryManager;
+ private readonly ICollectionManager _collectionManager;
+ private readonly TMDbClient _tmDbClient;
+ private readonly ILogger _logger;
+ ///
+ public TmdbNetworkCollectionsGenerator(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger logger)
+ {
+ _collectionManager = collectionManager;
+ _libraryManager = libraryManager;
+ // jellyfin source api key
+ Type type = Type.GetType("MediaBrowser.Providers.Plugins.Tmdb.TmdbUtils, MediaBrowser.Providers");
+ FieldInfo fieldInfo = type.GetField("ApiKey");
+ string apiKey = (string) fieldInfo.GetValue(null);
+ _tmDbClient = new TMDbClient(apiKey);
+ _logger = logger;
+ }
+
+ ///
+ public bool IsHidden => false;
+
+ ///
+ public bool IsEnabled => true;
+
+ ///
+ public bool IsLogged => true;
+
+ ///
+ public string Name => "TMDB Network Collections Generator Task";
+
+ ///
+ public string Key => "CollectionsGenerator";
+
+ ///
+ public string Description => "Generates Collections based on TMDB networks for shows";
+
+ ///
+ public string Category => "Collections Generation";
+
+ ///
+ public async Task Execute(CancellationToken cancellationToken, IProgress progress)
+ {
+ string tmdbNetworksInput = Plugin.Instance.Configuration.TmdbNetworks;
+ if (String.IsNullOrEmpty(tmdbNetworksInput)) {
+ this._logger.LogWarning("Did not find any Tmdb Network ids in plugin configuration");
+ return;
+ }
+ List tmdbNetworks = tmdbNetworksInput.Split(',').ToList();
+ foreach(string tmdbNetworkStr in tmdbNetworks) {
+ cancellationToken.ThrowIfCancellationRequested();
+ if (!int.TryParse(tmdbNetworkStr, out int tmdbNetwork))
+ {
+ this._logger.LogError("Found non integer Tmdb Network id", new string[] {tmdbNetworkStr});
+ continue;
+ }
+ Network network = await _tmDbClient.GetNetworkAsync(tmdbNetwork);
+ // get all shows per network
+ ICollection networkItemTmdbIds = this.GetNetworkItems(network);
+
+ // get existing boxset or create it
+ BoxSet existingCollection = this.GetExistingCollection(network.Name);
+ if (existingCollection == null) {
+ existingCollection = this.CreateCollection(network.Name);
+ }
+
+ var shows = this.GetShows();
+ List showGuids = this.GetTmDbApplicableShows(shows, networkItemTmdbIds);
+ // add shows to collection
+ await this._collectionManager.AddToCollectionAsync(existingCollection.Id, showGuids);
+ }
+ }
+
+ private List GetTmDbApplicableShows(IEnumerable shows,
+ ICollection networkItemTmdbIds)
+ {
+ List showGuids = new List();
+ foreach (var show in shows)
+ {
+ if (!show.ProviderIds.ContainsKey("Tmdb"))
+ {
+ // if the show doesn't have a Tmdb provider, we can't match it
+ // against a Tmdb network
+ this._logger.LogError("Show doesn't have a tmdb id", new string[] {show.Name});
+ continue;
+ }
+ var value = show.ProviderIds["Tmdb"];
+ if (!networkItemTmdbIds.Contains(Int32.Parse(value)))
+ {
+ // if the show doesn't match the networks tmdb item ids
+ // skip it
+ this._logger.LogError("Mismatch between tmdb network item tmdb id and jellyfin show tmdbid", new string[] {show.Name, value});
+ continue;
+ }
+ showGuids.Add(show.Id);
+ }
+ return showGuids;
+ }
+
+ private IEnumerable GetShows()
+ {
+ return _libraryManager.GetItemList(new MediaBrowser.Controller.Entities.InternalItemsQuery
+ {
+ IncludeItemTypes = new[] { nameof(MediaBrowser.Controller.Entities.TV.Series) },
+ IsVirtualItem = false,
+ Recursive = true,
+ HasTmdbId = true
+ }).Select(tvshow => tvshow as MediaBrowser.Controller.Entities.TV.Series).ToList();
+ }
+
+ private ICollection GetNetworkItems(Network network)
+ {
+ ICollection tmdbIds = new HashSet();
+ List networks = new List() { network };
+ SearchContainer result = null;
+ int page = 0;
+ // page through all the results
+ do {
+ result = _tmDbClient.DiscoverTvShowsAsync().WhereNetworksInclude(networks).Query(page).Result;
+ page = result.Page;
+
+ foreach (var item in result.Results) {
+ tmdbIds.Add(item.Id);
+ }
+
+ if (result.Page == result.TotalPages)
+ {
+ result = null;
+ }
+ page++;
+ } while (result != null);
+ return tmdbIds;
+ }
+
+ private BoxSet CreateCollection(string networkName)
+ {
+ CollectionCreationOptions options = new CollectionCreationOptions();
+ options.Name = networkName;
+ return _collectionManager.CreateCollectionAsync(options).Result;
+ }
+
+ private BoxSet GetExistingCollection(string networkName)
+ {
+ return _libraryManager.GetItemList(new MediaBrowser.Controller.Entities.InternalItemsQuery
+ {
+ IncludeItemTypes = new[] { nameof(BoxSet) },
+ CollapseBoxSetItems = false,
+ Recursive = true,
+ }).Select(boxSet => boxSet as BoxSet).Where(boxSet => boxSet.Name == networkName).FirstOrDefault();
+ }
+
+ ///
+ public IEnumerable GetDefaultTriggers()
+ {
+ return new[]
+ {
+ // run every sunday at 1am
+ new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerWeekly, TimeOfDayTicks = TimeSpan.FromHours(1).Ticks, DayOfWeek = DayOfWeek.Sunday }
+ };
+ }
+ }
+}
diff --git a/README.md b/README.md
index 1fdff16..54e1822 100644
--- a/README.md
+++ b/README.md
@@ -1,166 +1,17 @@
-# So you want to make a Jellyfin plugin
-
-Awesome! This guide is for you. Jellyfin plugins are written using the dotnet standard framework. What that means is you can write them in any language that implements the CLI or the DLI and can compile to netstandard2.1. The examples on this page are in C# because that is what most of Jellyfin is written in, but F#, Visual Basic, and IronPython should all be compatible once compiled.
-
-## 0. Things you need to get started
-
-- [Dotnet Core SDK 2.2](https://dotnet.microsoft.com/download)
-
-- An editor of your choice. Some free choices are:
-
- [Visual Studio Code](https://code.visualstudio.com/)
-
- [Visual Studio Community Edition](https://visualstudio.microsoft.com/downloads/)
-
- [Mono Develop](https://www.monodevelop.com/)
-
-## 0.5. Quickstarts
-
-We have a number of quickstart options available to speed you along the way.
-
-- [Download the Example Plugin Project](https://github.com/jellyfin/jellyfin-plugin-template/tree/master/Jellyfin.Plugin.Template) from this repository, open it in your IDE and go to [step 3](https://github.com/jellyfin/jellyfin-plugin-template#3-customize-plugin-information)
-
-- Install our dotnet template by [downloading the dotnet-template/content folder from this repo](https://github.com/jellyfin/jellyfin-plugin-template/tree/master/dotnet-template/content) or off of Nuget (Coming soon)
-
- ```
- dotnet new -i /path/to/templatefolder
- ```
-
-- Run this command then skip to step 4
-
- ```
- dotnet new Jellyfin-plugin -name MyPlugin
- ```
-
-If you'd rather start from scratch keep going on to step 1. This assumes no specific editor or IDE and requires only the command line with dotnet in the path.
-
-## 1. Initialize your Project
-
-Make a new dotnet standard project with the following command, it will make a directory for itself:
-
-```
-dotnet new classlib -f netstandard2.0 -n MyJellyFinPlugin
-```
-
-Now add the Jellyfin shared libraries.
-
-```
-dotnet add package Jellyfin.Model
-dotnet add package Jellyfin.Controller
-```
-
-You have an autogenerated Class1.cs file, you won't be needing this, so go ahead and delete it.
-
-## 2. Setup Basics
-
-There are a few mandatory classes you'll need for a plugin so we need to make them.
-
-### Make a new class called PluginConfiguration
-
-You can call it watever you'd like readlly. This class is used to hold settings your plugin might need. We can leave it empty for now. This class should inherit from `MediaBrowser.Model.Plugins.BasePluginConfiguration`
-
-### Make a new class called Plugin
-
-This is the main class for your plugin. It will define your name, version and Id. It should inherit from `MediaBrowser.Common.Plugins.BasePlugin `
-
-Note: If you called your PluginConfiguration class something different, you need to put that between the <>
-
-### Implement Required Properties
-
-The Plugin class needs a few properties implemented before it can work correctly.
-
-It needs an override on ID, an override on Name and a constructor that follows a specific model. To get started you can use the following snippit:
-
-```c#
-public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer){}
-public override string Name => throw new System.NotImplementedException();
-public override Guid Id => Guid.Parse("");
-```
-
-## 3. Customize Plugin Information
-
-You need to populate some of your plugin's information. Go ahead a put in a string of the Name you've overridden name, and generate a GUID
-- **Windows Users**: you can use the Powershell command `New-Guid`, `[guid]::NewGuid()` or the Visual Studio GUID generator
-- **Linux and OS X Users**: you can use the Powershell Core command `New-Guid` or this command from your shell of choice:
-
- ```bash
- od -x /dev/urandom | head -1 | awk '{OFS="-"; srand($6); sub(/./,"4",$5); sub(/./,substr("89ab",rand()*4,1),$6); print $2$3,$4,$5,$6,$7$8$9}'
- ```
-or
-
- ```bash
- uuidgen
- ```
-
-- Place that guid inside the `Guid.Parse("")` quotes to define your plugin's ID.
-
-## 4. Adding Functionality
-
-Congratulations, you now have everything you need for a perfectly functional functionless Jellyfin plugin! You can try it out right now if you'd like by compiling it, then placing the dll you generate in the plugins folder under your Jellyfin config directory. If you want to try and hook it up to a debugger make sure you copy the generated PDB file alongside it.
-
-Most people aren't satisfied with just having an entry in a menu for their plugin, most people want to have some functionality, so lets look at how to add it.
-
-### 4a. Implement interfaces to add components
-
-If the functionality you are trying to add is functionality related to something that Jellyfin has an interface for you're in luck. Jellyfin uses some automatic discovery and injection to allow any interfaces you implement in your plugin to be available in Jellyfin.
-
-Here's some interfaces you could implement for common use cases:
-
-- **IAuthenticationProvider** - Allows you to add an authentication provider that can authenticate a user based on a name and a password, but that doesn't expect to deal with local users.
-- **IBaseItemComparer** - Allows you to add sorting rules for dealing with media that will show up in sort menus
-- **IImageEnhancer** - Allows you to intercept and manipulate images served by Jellyfin
-- **IIntroProvider** - Allows you to play a piece of media before another piece of media (i.e. a trailer before a movie, or a network bumper before an episode of a show)
-- **IItemResolver** - Allows you to define custom media types
-- **ILibraryPostScanTask** - Allows you to define a task that fires after scanning a library
-- **ILibraryPreScanTask** - Allows you to define a task that fires before scanning a library
-- **IMetadataSaver** - Allows you to define a metadata standard that Jellyfin can use to write metadata
-- **IResolverIgnoreRule** - Allows you to define subpaths that are ignored by media resolvers for use with another function (i.e. you wanted to have a theme song for each tv series stored in a subfolder that could be accessed by your plugin for playback in a menu).
-- **IScheduledTask** - Allows you to create a scheduled task that will appear in the scheduled task lists on the dashboard.
-
-There are loads of other interfaces that can be used, but you'll need to poke around the API to get some info. If you're an expert on a particular interface, you should help [contribute some documentation](https://docs.jellyfin.org/general/contributing/index.html)!
-
-### 4b. Use plugin aimed interfaces to add custom functionality
-
-If your plugin doesn't fit perfectly neatly into a predefined interface, never fear, there are a set of interfaces that allow your plugin to extend Jellyfin any which way you please. Here's a quick overview on how to use them
-
-- **IPluginConfigurationPage** - Allows you to have a plugin config page on the dashboard. If you used one of the quickstart example projects, a premade page with some useful components to work with has been created for you! If not you can check out this guide here for how to whip one up.
-
-- **IRestfulService** - Allows you to extend the Jellyfin http API and handle API calls that come in on the routes you define.
-
-- **IServerEntryPoint** - Allows you to run code at server startup that will stay in memory. You can make as many of these as you need and it is wildly useful for loading configs or persisting state.
-
-Likewise you might need to get data and services from the Jellyfin core, Jellyfin provides a number of interfaces you can add as parameters to your plugin constructor which are then made available in your project (you can see the 2 mandatory ones that are needed by the plugin system in the constructor as is).
-
-- **IBlurayExaminer** - Allows you to examine blu-ray folders
-- **IDtoService** - Allows you to create data transport objects, presumably to send to other plugins or to the core
-- **IIsoManager** - Allows the mounting and unmounting of ISO files
-- **IJsonSerializer** - Allows you to use the main json serializer
-- **ILibraryManager** - Allows you to directly access the media libraries without hopping through the API
-- **ILocalizationManager** - Allows you tap into the main localization engine which governs translations, rating systems, units etc...
-- **ILogManager** - Allows you to create log entries with a custom name in the application log file
-- **INetworkManager** - Allows you to get information about the server's networking status
-- **INotificationsRepository** - Allows you to send notifications to users
-- **IServerApplicationPaths** - Allows you to get the running server's paths
-- **IServerConfigurationManager** - Allows you to write or read server configuration data into the application paths
-- **ITaskManager** - Allows you to execute and manipulate scheduled tasks
-- **IUserManager** - Allows you to retrieve user info and user library related info
-- **IXmlSerializer** - Allows you to use the main xml serializer
-- **IZipClient** - Allows you to use the core zip client for compressing and decompressing data
-
-## 5. Submit your Plugin
-
-- Choose a License, Jellyfin recommends [GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). If you would like your plugin to be integrated into Jellyfin and available from the plugin browser you MUST choose a [GPL Compatible License](https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses)
-
-- Upload your plugin to github.
-
-- Contact the Jellyfin Team!
-
-## A note about licensing
-
-Licensing is a complex topic. This repository features a GPLv3 license template that can be used to provide a good default license for your plugin. You may alter this if you like, but if you do a permissive license must be chosen.
-
-Due to how plugins in Jellyfin work, when your plugin is compiled into a binary, it will link against the various Jellyfin binary NuGet packages. These packages are licensed under the GPLv3. Thus, due to the nature and restrictions of the GPL, the binary plugin you get will also be licensed under the GPLv3.
-
-If you accept the default GPLv3 license from this template, all will be good. However if you choose a different license, please keep this fact in mind, as it might not always be obvious that an, e.g. MIT-licensed plugin would become GPLv3 when compiled.
-
-Please note that this also means making "proprietary", source-unavailable, or otherwise "hidden" plugins for public consumption is not permitted. To build a Jellyfin plugin for distribution to others, it must be under the GPLv3 or a permissive open-source license that can be linked against the GPLv3.
+# jellyfin-tmdb-collections-plugin
+Creates jellyfin collections based on tmdb networks. See https://www.themoviedb.org for networks
+
+## How it works
+- The plugin will run once a week and check for any shows that exist in the configured list of tmdb network ids.
+- If the show exists it will try to add it to a collection for the network.
+- If the collection doesn't exist, the plugin will create the collection automatically.
+- To access tmdb we rely on Jellyfins api key which is not exposed in any public apis, so we get it via reflection. NOTE - The existing DI tmdb client in jellyfin doesn't have a method exposed for accessing networks, hence why we just create another one here.
+
+## Installation
+
+1. Create a plugin folder in your jellyfin plugins folder called "tmdb-collections-plugin"
+2. Take the latest dll from releases (https://github.com/shayaantx/jellyfin-tmdb-collections-plugin/releases) and place it in the new plugin folder
+3. Restart jellyfin
+4. Go to Admin Dashboard -> Plugins -> Click the "TMDB Network Collections Generator" plugin.
+5. Enter your comma delimted list of tmdb networks. The easiest way to obtain these integers is to search a show on tmdb and get the network id from the show (the network is usually somewhere on the page)
+6. You can either wait a week or run it manually via the "Scheduled Tasks" page, it should be under "Collections Generation"
diff --git a/build.yaml b/build.yaml
deleted file mode 100644
index 36cc605..0000000
--- a/build.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
----
-name: "Template"
-guid: "eb5d7894-8eef-4b36-aa6f-5d124e828ce1"
-version: "1.0.0.0"
-targetAbi: "10.6.0.0"
-overview: "Short description about your plugin"
-description: >
- This is a longer description that can span more than one
- line and include details about your plugin.
-category: "General"
-owner: "jellyfin"
-artifacts:
-- "Jellyfin.Plugin.Template.dll"
-changelog: >
- changelog