From 8fff13e89ec824407c8e103db94978c716d15d5d Mon Sep 17 00:00:00 2001 From: Yangning Date: Thu, 9 Nov 2023 23:32:48 +0800 Subject: [PATCH] feat: Start from tinyMediaManager/scraperaddonsample see https://gitlab.com/tinyMediaManager/scraperaddonsample --- .classpath | 32 ++++++ .gitignore | 29 +++++ .project | 23 ++++ .settings/org.eclipse.jdt.core.prefs | 8 ++ README.md | 19 ++++ pom.xml | 32 ++++++ .../spisample/SampleAddonProvider.java | 44 ++++++++ .../spisample/SampleMovieArtworkProvider.java | 40 +++++++ .../SampleMovieMetadataProvider.java | 101 ++++++++++++++++++ .../SampleMovieSubtitleProvider.java | 40 +++++++ .../spisample/SampleMovieTrailerProvider.java | 40 +++++++ .../SampleTvShowArtworkProvider.java | 40 +++++++ .../SampleTvShowMetadataProvider.java | 57 ++++++++++ .../SampleTvShowSubtitleProvider.java | 40 +++++++ .../SampleTvShowTrailerProvider.java | 43 ++++++++ ...inymediamanager.scraper.spi.IAddonProvider | 1 + .../scraper/spisample/messages.properties | 1 + .../scraper/spisample/messages_de.properties | 1 + .../scraper/spisample/tmm_logo.svg | 38 +++++++ 19 files changed, 629 insertions(+) create mode 100644 .classpath create mode 100644 .gitignore create mode 100644 .project create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 README.md create mode 100644 pom.xml create mode 100644 src/main/java/org/tinymediamanager/scraper/spisample/SampleAddonProvider.java create mode 100644 src/main/java/org/tinymediamanager/scraper/spisample/SampleMovieArtworkProvider.java create mode 100644 src/main/java/org/tinymediamanager/scraper/spisample/SampleMovieMetadataProvider.java create mode 100644 src/main/java/org/tinymediamanager/scraper/spisample/SampleMovieSubtitleProvider.java create mode 100644 src/main/java/org/tinymediamanager/scraper/spisample/SampleMovieTrailerProvider.java create mode 100644 src/main/java/org/tinymediamanager/scraper/spisample/SampleTvShowArtworkProvider.java create mode 100644 src/main/java/org/tinymediamanager/scraper/spisample/SampleTvShowMetadataProvider.java create mode 100644 src/main/java/org/tinymediamanager/scraper/spisample/SampleTvShowSubtitleProvider.java create mode 100644 src/main/java/org/tinymediamanager/scraper/spisample/SampleTvShowTrailerProvider.java create mode 100644 src/main/resources/META-INF/services/org.tinymediamanager.scraper.spi.IAddonProvider create mode 100644 src/main/resources/org/tinymediamanager/scraper/spisample/messages.properties create mode 100644 src/main/resources/org/tinymediamanager/scraper/spisample/messages_de.properties create mode 100644 src/main/resources/org/tinymediamanager/scraper/spisample/tmm_logo.svg diff --git a/.classpath b/.classpath new file mode 100644 index 000000000..234db15be --- /dev/null +++ b/.classpath @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..aae4277a9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.war +*.ear + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +javacore* +jitdump* +Snap* + +#Maven +target +release.properties +pom.xml.* + +#IntelliJ IDEA +.idea/ +*.iml + +#Eclipse +/bin + +#Vim +*.swp diff --git a/.project b/.project new file mode 100644 index 000000000..0accce8e5 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + scraperaddonsample + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..2af1e7b99 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/README.md b/README.md new file mode 100644 index 000000000..dc8f18c44 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Scraper-Addon Sample +This project is a sample/template for a scraper addon which can be loaded in tinyMediaManager + +## i18n +tinyMediaManager can read localized scraper option names from the custom scraper via an own `ResourceBundle` (v4.3.9+). + +To use a custom `ResourceBundle` you need to + +1. Create your own properties files containing the literals/translated contents (see `src/main/java/org/tinymediamanager/scraper/spisample/messages.properties`) +2. Register your `ResourceBundle` in the `MediaProviderInfo` +```java +// the ResourceBundle to offer i18n support for scraper options +providerInfo.setResourceBundle(ResourceBundle.getBundle("org.tinymediamanager.scraper.spisample.messages")); +``` +3. Add a text for every option in the following form to the properties file +``` +#scraper..