diff --git a/.gitignore b/.gitignore index b7cf682..4ba412e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .DS* ._DS* *.pyo +*.pyc +*.db +/Filmliste-* /.vscode -backend/tmp diff --git a/LEGGIMI.md b/LEGGIMI.md deleted file mode 100644 index de98728..0000000 --- a/LEGGIMI.md +++ /dev/null @@ -1,87 +0,0 @@ -MediathekView Addon per Kodi -============================ - -Un altro addon Kodi per la navigazione nelle piattaforme video operate dalle -emittenti pubbliche tedesche... Perchè? - -Perché l'approccio di questo addon è diverso da quello degli altri addon -disponibili: questo addon utilizza il database del grande progetto -_"MediathekView"_, che viene aggiornato ogni ora e contiene oltre 200.000 voci -da tutte le piattaforme video tedesche. Questo approccio presenta alcuni -vantaggi significativi rispetto agli altri addon, che cercano di scansionare -i siti delle piattaforme video in tempo reale: - -* Navigazione nella libreria ad alta velocità -* Indipendenza da qualsiasi modifica al layout di pagina delle librerie multimediali -* Alta affidabilità - -Tutto questo è reso possibile dall'assiduo impegno del team di MediathekView -senza il quale un tale addon non sarebbe possibile. - -Tuttavia questo addon *non* è una parte ufficiale del progetto MediathekView, -ma uno sviluppo indipendente. - -Se si riscontrano problemi nell'uso di questo addon, si prega di segnalarli -all'indirizzo https://github.com/YeaSoft/plugin.video.mediathekview/issues - -Se questo addon è utile, sarebbe utile fare una donazione al team -MediathekView, perché senza il loro database questo addon non funzionerebbe. -Una possibilità corrispondente si trova sulla homepage del progetto -https://mediathekview.de/ - - -Come funziona -------------- - -L'addon scarica il database da MediathekView e lo importa in un database SQLite -locale o, in alternativa, in un database MySQL locale o remoto (per l'uso da -parte di più client Kodi). -Durante il runtime di Kodi, i file differenziali vengono scaricati da -MediathekView in un intervallo configurabile (predefinito: 2 ore) ed importati -nel database. Al più tardi entro il giorno successivo all'ultimo aggiornamento, -l'aggiornamento sarà nuovamente effettuato tramite l'aggiornamento completo -di Mediathekview. - -* Un file system con prestazioni accettabili per il database. Un Raspberry con - la sua lenta scheda SD non è certamente la miglior scelta ma sempre ancora - accettabile. La durata di un aggiornamento completo in questo caso sarà - intorno ai 15-20 minuti. Ma poiché questo accade in background, l'impatto - sarà essere accetabile. -* Il decompressore 'xz' sul sistema Kodi. Per utilizzare il programma di - aggiornamento del database, questo programma deve essere installato sul - sistema in una delle directory standard (/bin, /usr/bin, /usr/local/bin). In - Windows o se il programma è installato in una directory diversa, il percorso - del programma deve essere specificato nelle impostazioni dell'addon. Se il - decompressore non è disponibile per il sistema, l'addon mostra un messaggio - e disabilita il processo di aggiornamento. - - -Configurazioni alternative --------------------------- - -Se il sistema Kodi è troppo lento per gestire il proprio database (ad es. -Raspberry PI con una scheda SD molto lenta) o se manca il programma 'xz', -è anche possibile utilizzare l'addon con un database esterno (MySQL). - -Dal momento che molti utenti Kodi hanno il proprio sistema NAS per rendere i -loro contenuti mediali disponibili al media center, questo è di solito anche -adatto come server di database MySQL, dal momento che quasi tutti i sistemi -operativi NAS offrono l'installazione di un tale database. - -Dopodiche sarà sufficiente creare la banca dati mediante lo script SQL -disponibile in `resources/sql/filmliste-mysql-v1.sql`. - -Il collegamento al database può essere effettuato nelle impostazioni -dell'addon nella sezione "Impostazioni Banca Dati". - -Se almeno uno dei sistemi Kodi collegati è in grado di aggiornare il database, -l'addon funzionerà su tutti i sistemi Kodi. In caso contrario, è anche -possibile eseguire il processo di aggiornamento su un altro sistema (ad es. il -NAS, il server di database o un altro sistema). - - -Processo esterno di aggiornamento del database ----------------------------------------------- - -Questo non è ancora completamente implementato e documentato, ma sarà -dispüonibile in una delle prossime versioni. \ No newline at end of file diff --git a/LIESMICH.md b/LIESMICH.md deleted file mode 100644 index 72bb509..0000000 --- a/LIESMICH.md +++ /dev/null @@ -1,102 +0,0 @@ -MediathekView Addon für Kodi -============================ - -Und schon wieder ein Kodi-Addon für deutsche Mediatheken... Wozu das ganze? - -Weil der Ansatz dieses Addons ein anderer ist, als der der bereits verfügbaren -Addons: dieses Addon benutzt die Datenbank des großartigen Projektes -"MediathekView", welche stündlich aktualisiert wird über 200.000 Einträge aus -allen deutschen Mediatheken enthält. Dieser Ansatz hat einige entscheidende -Vorteile gegenüber den anderen Addons, die hingegen versuchen die Mediatheken -in Echtzeit zu scannen: - -* Hohe Geschwindigkeit beim Durchsuchen und Navigieren -* Unabhängigkeit von allen Änderungen des Seitenlayouts der Mediatheken -* Hohe Zuverlässigkeit - -Dies alles wird ermöglicht durch den unermüdlichen Einsatz des MediathekView- -Teams ohne den ein solches Addon nicht möglich wäre. - -Dieses Addon ist allerdings *nicht* offizieller Bestandteil des MediathekView- -Projektes, sondern eine unabhängige Entwicklung. - -Sollten Probleme bei der Benutzung dieses Addons auftreten, so können diese -unter https://github.com/YeaSoft/plugin.video.mediathekview/issues gemeldet -werden. - -Sollte dieses Addon nützlich sein, wäre es sinnvoll dem MediathekView-Team -eine Spende zukommen zu lassen, da ohne deren Datenbank dieses Addon nicht -funktionieren würde. Eine entsprechende Möglichkeit befindet sich auf der -Homepage https://mediathekview.de/ des Projektes. - -Funktionsweise --------------- - -Das Addon lädt die Datenbank von MediathekView herunter und importiert diese -entweder in einer lokalen SQLite Datenbank, oder wahlweise in einer lokalen -oder entfernten MySQL Datenbank (zur Benutzung durch mehrere Kodi-Clients). -Während der Laufzeit von Kodi werden in einem konfigurierbaren Intervall -(Standard: 2 Stunden) die Differenzdateien von MediathekView heruntergeladen -und in die Datenbank integriert. Spätestens beim nächsten Kalendertag nach -dem letzten Update wird die Aktualisierung wieder mittels des vollständigen -Updates von Mediathekview ausgeführt. - -Systemvoraussetzungen ---------------------- - -Die Systemvoraussetzungen für das Addon unterscheiden sich je nach -Konfiguration. Nach der Installation startet das Addon im lokalen Modus: -dies bedeutet, dass eine lokale SQLite-Datenbank benutzt wird, die auch -durch das Kodi-System lokal aktualisiert wird. Dies dürfte auch das -üblichste Szenario sein. - -Dieses Szenario birgt zwei Voraussetzungen die erfüllt sein sollten: -* ein einigermaßen performantes Dateisystem für die Datenbank. Ein Raspberry - mit seiner langsamen SD-Karte ist in diesem Fall sicherlich nicht die - allerbeste Wahl. Das vollständige Update der Datenbank dauert hier um die - 15-20 Minuten. Da dies aber im Hintergrund passiert, kann man unter Umständen - gut damit leben. -* der Entpacker 'xz' auf dem Kodi-System. Um den Datenbank-Aktualisierer zu - benutzen, muss dieses Programm auf dem System in einem der Standard- - Verzeichnisse (/bin, /usr/bin, /usr/local/bin) installiert werden. - Unter Windows bzw. falls das Programm in einem anderen Verzeichnis - installiert ist, muss der Pfad zum Programm in den Addon-Einstellungen - angegeben werden. Sollte der Entpacker nicht vorhanden sein, so gibt - das Addon eine Meldung aus und deaktiviert den Aktualisierungsprozess. - -Das Addon wurde auf verschiedenen Plattformen unter Linux, MacOS und LibreELEC -bzw. OpenELEC getestet. Dort war auch der entsprechende Entpacker verfügbar. -Unter Windows muss der Entpacker nachträglich installiert werden und dessen -Pfad in den Addon-Einstellungen angegeben werden. Mangels Testsystem konnte -dies jedoch zum jetzigen Zeitpunkt noch nicht getestet werden. - -Alternativ-Konfigurationen --------------------------- - -Ist das Kodi-System zu langsam um eine eigene Datenbank zu verwalten -(z.B. Raspberry PI mit sehr langsamer SD-Karte) oder fehlt das Programm -'xz', so besteht die Möglichkeit das Addon auch mit einer externen -Datenbank (MySQL) zu nutzen. - -Da viele Kodi-Nutzer über ein eigenes NAS-System verfügen um ihre Medien -dem Media-Center zur Verfügung zu stellen, eignet sich dieses in der Regel -auch als MySQL Datenbank-Server da nahezu alle NAS-Betriebssysteme die -Installation eines solchen anbieten. - -Hierfür muss lediglich die entsprechende Datenbank im MySQL Server mit -dem SQL-Skript `resources/sql/filmliste-mysql-v1.sql` erzeugt werden. - -Die Verbindung zur Datenbank kann in den Addon-Einstellungen im Abschnitt -_"Datenbank Einstellungen"_ vorgenommen werden. - -Ist mindestens eines der angeschlossenen Kodi-Systeme in der Lage das Update -der Datenbank durchzuführen, so ist für das Update gesorgt. Sollte dies nicht -der Fall sein, so besteht auch die Möglichkeit, den Update-Prozess auf einem -anderen System (z.B. das NAS, den Datenbankserver oder eine andere Maschine) -laufen zu lassen. - -Standalone Datenbank Update Prozess ------------------------------------ - -Dieser ist noch nicht vollständig implementiert und dokumentiert, wird aber in -eine der nächsten Versionen nachgeliefert. \ No newline at end of file diff --git a/README.md b/README.md index 8b06401..7e97115 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,170 @@ -MediathekView Addon for Kodi -============================ +Kodi MediathekView Addon +======================== + +* **English Version:** Please see below +* **Versione Italiana:** Il testo italiano si trova più in basso + +Über dieses Addon +----------------- + +Und schon wieder ein Kodi-Addon für deutsche Mediatheken... Wozu das ganze? + +Weil der Ansatz dieses Addons ein anderer ist, als der der bereits verfügbaren +Addons: dieses Addon benutzt die Datenbank des großartigen Projektes +"MediathekView", welche stündlich aktualisiert wird über 200.000 Einträge aus +allen deutschen Mediatheken enthält. Dieser Ansatz hat einige entscheidende +Vorteile gegenüber den anderen Addons, die hingegen versuchen die Mediatheken +in Echtzeit zu scannen: + +* Hohe Geschwindigkeit beim Durchsuchen und Navigieren +* Unabhängigkeit von allen Änderungen des Seitenlayouts der Mediatheken +* Hohe Zuverlässigkeit + +Dies alles wird ermöglicht durch den unermüdlichen Einsatz des MediathekView- +Teams ohne den ein solches Addon nicht möglich wäre. + +Dieses Addon ist allerdings *nicht* offizieller Bestandteil des MediathekView- +Projektes, sondern eine unabhängige Entwicklung. + +Sollten Probleme bei der Benutzung dieses Addons auftreten, so können diese +unter https://github.com/mediathekview/plugin.video.mediathekview/issues +gemeldet werden. + +Sollte dieses Addon nützlich sein, wäre es sinnvoll dem MediathekView-Team +eine Spende zukommen zu lassen, da ohne deren Datenbank dieses Addon nicht +funktionieren würde. Eine entsprechende Möglichkeit befindet sich auf der +Homepage https://mediathekview.de/ des Projektes. + +Wichtigste Features +------------------- +* Hintergrundaktualisierung der Datenbank +* Blitzschnelle Navigation +* Herunterlladen von Filmen mit automatischer Erzeugung von NFO Dateien und + eventueller Untertitel +* Lokale interne Datenbank oder geteilte MySQL Datenbank +* Benutzeroberfläche verfügbar in Deutsch, Englisch und Italienisch + +Funktionsweise +-------------- + +Das Addon lädt die Datenbank von MediathekView herunter und importiert diese +entweder in einer lokalen SQLite Datenbank, oder wahlweise in einer lokalen +oder entfernten MySQL Datenbank (zur Benutzung durch mehrere Kodi-Clients). +Während der Laufzeit von Kodi werden in einem konfigurierbaren Intervall +(Standard: 2 Stunden) die Differenzdateien von MediathekView heruntergeladen +und in die Datenbank integriert. Spätestens beim nächsten Kalendertag nach +dem letzten Update wird die Aktualisierung wieder mittels des vollständigen +Updates von Mediathekview ausgeführt. + +Systemvoraussetzungen +--------------------- + +Die Systemvoraussetzungen für das Addon unterscheiden sich je nach +Konfiguration. Nach der Installation startet das Addon im lokalen Modus: +dies bedeutet, dass eine lokale SQLite-Datenbank benutzt wird, die auch +durch das Kodi-System lokal aktualisiert wird. Dies dürfte auch das +üblichste Szenario sein. + +Dieses Szenario birgt zwei Voraussetzungen die erfüllt sein sollten: +* ein einigermaßen performantes Dateisystem für die Datenbank. Ein Raspberry + mit seiner langsamen SD-Karte ist in diesem Fall sicherlich nicht die + allerbeste Wahl. Das vollständige Update der Datenbank dauert hier um die + 15-20 Minuten. Da dies aber im Hintergrund passiert, kann man unter Umständen + gut damit leben. +* der Entpacker 'xz' auf dem Kodi-System. Um den Datenbank-Aktualisierer zu + benutzen, muss dieses Programm auf dem System in einem der Standard- + Verzeichnisse (/bin, /usr/bin, /usr/local/bin) installiert werden. + Unter Windows bzw. falls das Programm in einem anderen Verzeichnis + installiert ist, muss der Pfad zum Programm in den Addon-Einstellungen + angegeben werden. Sollte der Entpacker nicht vorhanden sein, so gibt + das Addon eine Meldung aus und deaktiviert den Aktualisierungsprozess. + +Das Addon wurde auf verschiedenen Plattformen unter Linux, MacOS und LibreELEC +bzw. OpenELEC getestet. Dort war auch der entsprechende Entpacker verfügbar. +Unter Windows muss der Entpacker nachträglich installiert werden und dessen +Pfad in den Addon-Einstellungen angegeben werden. Mangels Testsystem konnte +dies jedoch zum jetzigen Zeitpunkt noch nicht getestet werden. + +Alternativ-Konfigurationen +-------------------------- + +Ist das Kodi-System zu langsam um eine eigene Datenbank zu verwalten +(z.B. Raspberry PI mit sehr langsamer SD-Karte) oder fehlt das Programm +'xz', so besteht die Möglichkeit das Addon auch mit einer externen +Datenbank (MySQL) zu nutzen. + +Da viele Kodi-Nutzer über ein eigenes NAS-System verfügen um ihre Medien +dem Media-Center zur Verfügung zu stellen, eignet sich dieses in der Regel +auch als MySQL Datenbank-Server da nahezu alle NAS-Betriebssysteme die +Installation eines solchen anbieten. + +Hierfür muss lediglich die entsprechende Datenbank im MySQL Server mit +dem SQL-Skript `resources/sql/filmliste-mysql-v1.sql` erzeugt werden. + +Die Verbindung zur Datenbank kann in den Addon-Einstellungen im Abschnitt +_"Datenbank Einstellungen"_ vorgenommen werden. + +Ist mindestens eines der angeschlossenen Kodi-Systeme in der Lage das Update +der Datenbank durchzuführen, so ist für das Update gesorgt. Sollte dies nicht +der Fall sein, so besteht auch die Möglichkeit, den Update-Prozess auf einem +anderen System (z.B. das NAS, den Datenbankserver oder eine andere Maschine) +laufen zu lassen. + +Standalone Datenbank Update Prozess +----------------------------------- + +Um die Datenbankaktualisierung von der Kommandozeile auszuführen, muss das +Zielsystem einen python2-Interpreter bereitstellen. Des weiteren müssen noch +folgende zwei Bibliotheken zur Verfügung stehen, sowie das Entpackprogramm +'xz': + +* ijson +* mysql-connector + +Die Installation dieser Bibliotheken erfolgt durch Eingabe folgender Befehle: + +```` +pip install ijson +pip install mysql-connector==2.1.4 +```` + +Das Aktualisierungsprogramm heisst `mvupdate` und liegt im Hauptverzeichnis +des Addons und muss auch von dort ausgeführt werden. Aus diesem Grunde muss +das Addon in einem Verzeichnis aus der ausführenden Maschine kopiert werden. + +Dies kann entweder durch Herunterladen und Entpacken der Addon-ZIP-Datei +erfolgen oder durch Klonen des Addon-Quellcode-Repositories mittels `git` + +```` +git clone git@github.com:mediathekview/plugin.video.mediathekview.git +```` + +Durch Angabe des Parameters `-h` bzw. `-h` hinter dem Datenbanktyp, gibt +das Programm spezifische Hilfe aus. Beispiel: + +```` +leo@bookpoldo ~/plugin.video.mediathekview $ ./mvupdate mysql -h +usage: mvupdate mysql [-h] [-H HOST] [-u USER] [-p PASSWORD] [-d DATABASE] + +optional arguments: + -h, --help show this help message and exit + -H HOST, --host HOST hostname or ip of the MySQL server (default: + localhost) + -u USER, --user USER username for the MySQL server connection (default: + filmliste) + -p PASSWORD, --password PASSWORD + password for the MySQL server connection (default: + None) + -d DATABASE, --database DATABASE + MySQL database for mediathekview (default: filmliste) +```` + + +English Version +=============== + +About this Addon +---------------- Yet another Kodi-Addon for the german pupblic service video platforms... Why? @@ -20,7 +185,7 @@ This addon *is not* an official part of the MediathekView project but an independent development. If you encounter any problems using this addon, please report them to -https://github.com/YeaSoft/plugin.video.mediathekview/issues +https://github.com/mediathekview/plugin.video.mediathekview/issues If you like this addon, consider making a donation to the MediathekView team, because without their database this addon would not work at all. @@ -28,6 +193,15 @@ You will find the possibility to make a donation on the project's homepage https://mediathekview.de/ +Highlights +---------- +* Background updating of the database +* Amazing fast navigation and search +* Download with subtitles and automatic NFO file generation +* Internal standalone or shared MySQL database support +* UI localised to German, English and Italian + + How it Works ------------ @@ -92,5 +266,190 @@ the database server or another machine). Standalone Database Update Process ---------------------------------- -This is not yet fully implemented and documented, but will be delivered in one -of the next versions. +A python2 interpreter as well as the unpacker 'xz' is requirered on the +target system in order to execute the commandline update process. Additionally +the following python libraries are required: + +* ijson +* mysql-connector + +The required libraries can be installed via pip: + +```` +pip install ijson +pip install mysql-connector==2.1.4 +```` + +The update program is called `mvupdate` and is located in the root directory +of the addon and must be executed from there. The whole addon has to be copied +to the target machine. + +This can be either done by downloading and unpacking the addon archive or +by cloning the source repository with `git` + +```` +git clone git@github.com:mediathekview/plugin.video.mediathekview.git +```` + +By specifying the option `-h` itself or after the requested database type, +the application shows specific help instructions: + +```` +leo@bookpoldo ~/plugin.video.mediathekview $ ./mvupdate mysql -h +usage: mvupdate mysql [-h] [-H HOST] [-u USER] [-p PASSWORD] [-d DATABASE] + +optional arguments: + -h, --help show this help message and exit + -H HOST, --host HOST hostname or ip of the MySQL server (default: + localhost) + -u USER, --user USER username for the MySQL server connection (default: + filmliste) + -p PASSWORD, --password PASSWORD + password for the MySQL server connection (default: + None) + -d DATABASE, --database DATABASE + MySQL database for mediathekview (default: filmliste) +```` + + + +Versione Italiana +================= + +Un altro addon Kodi per la navigazione nelle piattaforme video operate dalle +emittenti pubbliche tedesche... Perchè? + +Perché l'approccio di questo addon è diverso da quello degli altri addon +disponibili: questo addon utilizza il database del grande progetto +_"MediathekView"_, che viene aggiornato ogni ora e contiene oltre 200.000 voci +da tutte le piattaforme video tedesche. Questo approccio presenta alcuni +vantaggi significativi rispetto agli altri addon, che cercano di scansionare +i siti delle piattaforme video in tempo reale: + +* Navigazione nella libreria ad alta velocità +* Indipendenza da qualsiasi modifica al layout di pagina delle librerie multimediali +* Alta affidabilità + +Tutto questo è reso possibile dall'assiduo impegno del team di MediathekView +senza il quale un tale addon non sarebbe possibile. + +Tuttavia questo addon *non* è una parte ufficiale del progetto MediathekView, +ma uno sviluppo indipendente. + +Se si riscontrano problemi nell'uso di questo addon, si prega di segnalarli +all'indirizzo https://github.com/mediathekview/plugin.video.mediathekview/issues + +Se questo addon è utile, sarebbe utile fare una donazione al team +MediathekView, perché senza il loro database questo addon non funzionerebbe. +Una possibilità corrispondente si trova sulla homepage del progetto +https://mediathekview.de/ + + +Highlights +---------- +* Attualizzazione della banca dati in background +* Navigazione e ricerca velocissima +* Scaricamento video con generazione automatica die file NFO e scaricamento + sottotitoli +* Banca dati interna o banca dati condivisa a base MySQL +* Interfaccia disponibile in Italiano, Inglese e Tedesco + + +Come funziona +------------- + +L'addon scarica il database da MediathekView e lo importa in un database SQLite +locale o, in alternativa, in un database MySQL locale o remoto (per l'uso da +parte di più client Kodi). +Durante il runtime di Kodi, i file differenziali vengono scaricati da +MediathekView in un intervallo configurabile (predefinito: 2 ore) ed importati +nel database. Al più tardi entro il giorno successivo all'ultimo aggiornamento, +l'aggiornamento sarà nuovamente effettuato tramite l'aggiornamento completo +di Mediathekview. + +* Un file system con prestazioni accettabili per il database. Un Raspberry con + la sua lenta scheda SD non è certamente la miglior scelta ma sempre ancora + accettabile. La durata di un aggiornamento completo in questo caso sarà + intorno ai 15-20 minuti. Ma poiché questo accade in background, l'impatto + sarà essere accetabile. +* Il decompressore 'xz' sul sistema Kodi. Per utilizzare il programma di + aggiornamento del database, questo programma deve essere installato sul + sistema in una delle directory standard (/bin, /usr/bin, /usr/local/bin). In + Windows o se il programma è installato in una directory diversa, il percorso + del programma deve essere specificato nelle impostazioni dell'addon. Se il + decompressore non è disponibile per il sistema, l'addon mostra un messaggio + e disabilita il processo di aggiornamento. + + +Configurazioni alternative +-------------------------- + +Se il sistema Kodi è troppo lento per gestire il proprio database (ad es. +Raspberry PI con una scheda SD molto lenta) o se manca il programma 'xz', +è anche possibile utilizzare l'addon con un database esterno (MySQL). + +Dal momento che molti utenti Kodi hanno il proprio sistema NAS per rendere i +loro contenuti mediali disponibili al media center, questo è di solito anche +adatto come server di database MySQL, dal momento che quasi tutti i sistemi +operativi NAS offrono l'installazione di un tale database. + +Dopodiche sarà sufficiente creare la banca dati mediante lo script SQL +disponibile in `resources/sql/filmliste-mysql-v1.sql`. + +Il collegamento al database può essere effettuato nelle impostazioni +dell'addon nella sezione "Impostazioni Banca Dati". + +Se almeno uno dei sistemi Kodi collegati è in grado di aggiornare il database, +l'addon funzionerà su tutti i sistemi Kodi. In caso contrario, è anche +possibile eseguire il processo di aggiornamento su un altro sistema (ad es. il +NAS, il server di database o un altro sistema). + + +Processo esterno di aggiornamento del database +---------------------------------------------- + +Per eseguire il processo esterno di aggiornamento del database, è necessario +che sul sistema sul quale il processo viene eseguito sia istallato un +interprete python2, il programma di decompressione 'xz' e le seguenti +librerie python: + +* ijson +* mysql-connector + +QUeste potranno essere istallate mediante il programma pip: + +```` +pip install ijson +pip install mysql-connector==2.1.4 +```` + +Il programma di aggiornamento si chiama `mvupdate` e si trova nella directory +principale dell'addon e dovrà essere lanciato da questa directory. L'intero +addon dovrà essere copiato sul sistema di destinazione. + +Questo sarà possibile sia scaricando l'archivio dell'addon che dovrà essere +spacchettato in loco o mediante clonaggio dai sorgenti mediante `git` + +```` +git clone git@github.com:mediathekview/plugin.video.mediathekview.git +```` + +Specificando l'opzione `-h` a se stante o a tergo del tipo di database da +aggiornare, l'applicazione mostrerà le opzioni disponibili: + +```` +leo@bookpoldo ~/plugin.video.mediathekview $ ./mvupdate mysql -h +usage: mvupdate mysql [-h] [-H HOST] [-u USER] [-p PASSWORD] [-d DATABASE] + +optional arguments: + -h, --help show this help message and exit + -H HOST, --host HOST hostname or ip of the MySQL server (default: + localhost) + -u USER, --user USER username for the MySQL server connection (default: + filmliste) + -p PASSWORD, --password PASSWORD + password for the MySQL server connection (default: + None) + -d DATABASE, --database DATABASE + MySQL database for mediathekview (default: filmliste) +```` diff --git a/addon.py b/addon.py index 164ac0e..7d765e9 100644 --- a/addon.py +++ b/addon.py @@ -1,6 +1,26 @@ # -*- coding: utf-8 -*- -# Copyright 2017 Leo Moll # +# MIT License +# +# Copyright (c) 2017-2018, Leo Moll +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. # -- Imports ------------------------------------------------ from __future__ import unicode_literals # ,absolute_import, division @@ -150,7 +170,7 @@ def Init( self ): self.language( 30964 ) ) - def doDownloadFilm( self, filmid ): + def doDownloadFilm( self, filmid, quality ): if self.settings.downloadpath: film = self.db.RetrieveFilmInfo( filmid ) if film is None: @@ -163,7 +183,14 @@ def doDownloadFilm( self, filmid ): return # get the best url - videourl = film.url_video_hd if ( film.url_video_hd and self.settings.preferhd ) else film.url_video if film.url_video else film.url_video_sd + if quality == '0' and film.url_video_sd: + videourl = film.url_video_sd + elif quality == '2' and film.url_video_hd: + videourl = film.url_video_hd + else: + videourl = film.url_video + + # prepare names showname = self._cleanup_filename( film.show )[:64] filestem = self._cleanup_filename( film.title )[:64] extension = os.path.splitext( videourl )[1] @@ -243,6 +270,7 @@ def _make_nfo_files( self, film, episode, dirname, filename, videourl ): try: file = xbmcvfs.File( dirname + 'tvshow.nfo', 'w' ) file.write( bytearray( '\n', 'utf-8' ) ) + file.write( bytearray( '\n', 'utf-8' ) ) file.write( bytearray( '\t{}\n'.format( film.show ), 'utf-8' ) ) file.write( bytearray( '\t{}\n'.format( film.show ), 'utf-8' ) ) # file.write( bytearray( '\t{}\n'.format( 2018 ), 'utf-8' ) ) # XXX TODO: That might be incorrect! @@ -313,7 +341,9 @@ def Do( self ): show = self.args.get( 'show', [0] ) self.db.GetFilms( show[0], FilmUI( self ) ) elif mode[0] == 'download': - self.doDownloadFilm( self.args.get( 'id', [0] )[0] ) + filmid = self.args.get( 'id', [0] ) + quality = self.args.get( 'quality', [1] ) + self.doDownloadFilm( filmid[0], quality[0] ) elif mode[0] == 'enqueue': self.doEnqueueFilm( self.args.get( 'id', [0] )[0] ) diff --git a/addon.xml b/addon.xml index ee5e0df..d208013 100644 --- a/addon.xml +++ b/addon.xml @@ -1,8 +1,8 @@ + version="0.3.3" + provider-name="MediathekView.de, Leo Moll"> @@ -25,7 +25,12 @@ Ermöglicht den Zugriff auf fast alle deutschen Mediatheken der öffentlich Rechtlichen basierend auf der Datenbank von MediathekView Gives access to most video-platforms from German public service broadcasters using the database of MediathekView Fornisce l'accesso a gran parte delle piattaforme video operate dalle emittenti pubbliche tedesche usando la banca dati di MediathekView - v0.3.2 (2018-01-08): + v0.3.3 (2018-01-09): +- Auflösung kann nun beim Download ausgewählt werden +- Kommandozeilenaktualisierer wurde implementiert +- Fehler in der Generierung von tvshow.nfo behoben +- Die README Datei enthält nun alle Sprachen +v0.3.2 (2018-01-08): - Fixed error when downloading files with umlauts - Downloads to VFS locations are now directly written without intermediate storage - Improved quality of NFO files @@ -39,10 +44,10 @@ v0.3.0 (2018-01-07): all de fr MIT License - - https://github.com/YeaSoft/plugin.video.mediathekview - - + https://forum.kodi.tv/showthread.php?tid=326799 + https://github.com/mediathekview/plugin.video.mediathekview + https://mediathekview.de/ + info@mediathekview.de resources/icon.jpg resources/fanart.jpg diff --git a/classes/filmui.py b/classes/filmui.py index 1204683..eb2cfa8 100644 --- a/classes/filmui.py +++ b/classes/filmui.py @@ -72,12 +72,24 @@ def Add( self, alttitle = None ): # Download video contextmenu.append( ( self.plugin.language( 30921 ), - 'RunPlugin({})'.format( self.plugin.build_url( { 'mode': "download", 'id': self.id } ) ) + 'RunPlugin({})'.format( self.plugin.build_url( { 'mode': "download", 'id': self.id, 'quality': 1 } ) ) ) ) + if self.url_video_hd: + # Download SD video + contextmenu.append( ( + self.plugin.language( 30923 ), + 'RunPlugin({})'.format( self.plugin.build_url( { 'mode': "download", 'id': self.id, 'quality': 2 } ) ) + ) ) + if self.url_video_sd: + # Download SD video + contextmenu.append( ( + self.plugin.language( 30922 ), + 'RunPlugin({})'.format( self.plugin.build_url( { 'mode': "download", 'id': self.id, 'quality': 0 } ) ) + ) ) # Add to queue # TODO: Enable later # contextmenu.append( ( -# self.plugin.language( 30922 ), +# self.plugin.language( 30924 ), # 'RunPlugin({})'.format( self.plugin.build_url( { 'mode': "enqueue", 'id': self.id } ) ) # ) ) li.addContextMenuItems( contextmenu ) diff --git a/classes/mvupdate.py b/classes/mvupdate.py new file mode 100644 index 0000000..f314679 --- /dev/null +++ b/classes/mvupdate.py @@ -0,0 +1,200 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2017-2018, Leo Moll + +# -- Imports ------------------------------------------------ +import os +import sys +import argparse +import datetime +import xml.etree.ElementTree as ET + +from de.yeasoft.base.Logger import Logger +from classes.store import Store +from classes.updater import MediathekViewUpdater + +# -- Classes ------------------------------------------------ +class Settings( object ): + def __init__( self, args ): + self.datapath = args.path if args.dbtype == 'sqlite' else './' + self.type = { 'sqlite' : '0', 'mysql' : '1' }.get( args.dbtype, '0' ) + if self.type == '1': + self.host = args.host + self.user = args.user + self.password = args.password + self.database = args.database + self.nofuture = True + self.minlength = 0 + self.groupshows = False + self.updenabled = True + self.updinterval = 3600 + self.updxzbin = '' + +class AppLogger( Logger ): + + def __init__( self, name, version, topic = None, verbosity = 0 ): + super( AppLogger, self ).__init__( name, version, topic ) + self.verbosity = verbosity + + def getNewLogger( self, topic = None ): + return AppLogger( self.name, self.version, topic, self.verbosity ) + + def debug( self, message, *args ): + self._log( 2, message, *args ) + + def info( self, message, *args ): + self._log( 1, message, *args ) + + def warn( self, message, *args ): + self._log( 0, message, *args ) + + def error( self, message, *args ): + self._log( -1, message, *args ) + + def _log( self, level, message, *args ): + parts = [] + for arg in args: + part = arg + if isinstance( arg, basestring ): + part = arg # arg.decode('utf-8') + parts.append( part ) + output = '{} {} {}{}'.format( + datetime.datetime.now(), + { -1: 'ERROR', 0: 'WARNING', 1: 'NOTICE', 2: 'DEBUG' }.get( level, 2 ), + self.prefix, + message.format( *parts ) + ) + + if level < 0: + # error + sys.stderr.write( output + '\n' ) + sys.stderr.flush() + elif self.verbosity >= level: + # other message + print( output ) + +class Notifier( object ): + def __init__( self ): + pass + def GetEnteredText( self, deftext = '', heading = '', hidden = False ): + pass + def ShowNotification( self, heading, message, icon = None, time = 5000, sound = True ): + pass + def ShowWarning( self, heading, message, time = 5000, sound = True ): + pass + def ShowError( self, heading, message, time = 5000, sound = True ): + pass + def ShowBGDialog( self, heading = None, message = None ): + pass + def UpdateBGDialog( self, percent, heading = None, message = None ): + pass + def CloseBGDialog( self ): + pass + def ShowDatabaseError( self, err ): + pass + def ShowDownloadError( self, name, err ): + pass + def ShowMissingXZError( self ): + pass + def ShowDownloadProgress( self ): + pass + def UpdateDownloadProgress( self, percent, message = None ): + pass + def CloseDownloadProgress( self ): + pass + def ShowUpdateProgress( self ): + pass + def UpdateUpdateProgress( self, percent, count, channels, shows, movies ): + pass + def CloseUpdateProgress( self ): + pass + +class MediathekViewMonitor( object ): + def abortRequested( self ): + return False + +class UpdateApp( AppLogger ): + def __init__( self ): + try: + self.mypath = os.path.dirname( sys.argv[0] ) + tree = ET.parse( self.mypath + '/addon.xml' ) + version = tree.getroot().attrib['version'] + AppLogger.__init__( self, os.path.basename( sys.argv[0] ), version ) + except Exception as err: + AppLogger.__init__( self, os.path.basename( sys.argv[0] ), '0.0' ) + + def Init( self ): + parser = argparse.ArgumentParser( + formatter_class = argparse.ArgumentDefaultsHelpFormatter, + description = 'This is the standalone database updater. It downloads the current database update from mediathekview.de and integrates it in a local database' + ) + parser.add_argument( + '-v', '--verbose', + default = 0, + action = 'count', + help = 'Show progress messages' + ) + subparsers = parser.add_subparsers( + dest = 'dbtype', + help = 'target database' + ) + sqliteopts = subparsers.add_parser( 'sqlite', formatter_class = argparse.ArgumentDefaultsHelpFormatter ) + sqliteopts.add_argument( + '-p', '--path', + dest = 'path', + help = 'alternative path for the sqlite database', + default = './' + ) + mysqlopts = subparsers.add_parser( 'mysql', formatter_class = argparse.ArgumentDefaultsHelpFormatter ) + mysqlopts.add_argument( + '-H', '--host', + dest = 'host', + help = 'hostname or ip of the MySQL server', + default = 'localhost' + ) + mysqlopts.add_argument( + '-u', '--user', + dest = 'user', + help = 'username for the MySQL server connection', + default = 'filmliste' + ) + mysqlopts.add_argument( + '-p', '--password', + dest = 'password', + help = 'password for the MySQL server connection', + default = None + ) + mysqlopts.add_argument( + '-d', '--database', + dest = 'database', + default = 'filmliste', + help = 'MySQL database for mediathekview' + ) + self.args = parser.parse_args() + self.verbosity = self.args.verbose + + self.info( 'Startup' ) + self.settings = Settings( self.args ) + self.notifier = Notifier() + self.monitor = MediathekViewMonitor() + self.updater = MediathekViewUpdater( self.getNewLogger( 'MediathekViewUpdater' ), self.notifier, self.settings, self.monitor ) + if self.updater.PrerequisitesMissing(): + self.error( 'Prerequisites are missing' ) + self.Exit() + exit( 1 ) + self.updater.Init() + + def Run( self ): + self.info( 'Starting up...' ) + updateop = self.updater.GetCurrentUpdateOperation() + if updateop == 1: + # full update + self.info( 'Initiating full update...' ) + self.updater.Update( True ) + elif updateop == 2: + # differential update + self.info( 'Initiating differential update...' ) + self.updater.Update( False ) + self.info( 'Exiting...' ) + + def Exit( self ): + self.updater.Exit() diff --git a/classes/updater.py b/classes/updater.py index f094d8e..8609303 100644 --- a/classes/updater.py +++ b/classes/updater.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2017 Leo Moll -# +# Copyright (c) 2017-2018, Leo Moll # -- Imports ------------------------------------------------ import os, stat, urllib, urllib2, subprocess, ijson, datetime, time @@ -155,6 +154,12 @@ def Import( self, full ): self.logger.info( 'Import of {} finished', destfile ) self.notifier.CloseUpdateProgress() return True + except KeyboardInterrupt: + file.close() + self._update_end( full, 'ABORTED' ) + self.logger.info( 'Interrupted by user' ) + self.notifier.CloseUpdateProgress() + return True except DatabaseCorrupted as err: self.logger.error( '{}', err ) self.notifier.CloseUpdateProgress() diff --git a/mvupdate b/mvupdate new file mode 100755 index 0000000..56aedc0 --- /dev/null +++ b/mvupdate @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# MIT License +# +# Copyright (c) 2017-2018, Leo Moll +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# -- Imports ------------------------------------------------ +from __future__ import unicode_literals +from classes.mvupdate import UpdateApp + +# -- Main Code ---------------------------------------------- +if __name__ == '__main__': + app = UpdateApp() + app.Init() + app.Run() + app.Exit() + del app diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index 7fd76e3..230a0cc 100644 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -122,10 +122,18 @@ msgstr "" # Context Menu msgctxt "#30921" -msgid "Download video" +msgid "Download Video" msgstr "" msgctxt "#30922" +msgid "Download LoRes Video" +msgstr "" + +msgctxt "#30923" +msgid "Download HD Video" +msgstr "" + +msgctxt "#30924" msgid "Add to queue" msgstr "" diff --git a/resources/language/German/strings.po b/resources/language/German/strings.po index 9dc77ad..f83133f 100644 --- a/resources/language/German/strings.po +++ b/resources/language/German/strings.po @@ -126,6 +126,14 @@ msgid "Video herunterladen" msgstr "" msgctxt "#30922" +msgid "Niedrig auflösendes Video herunterladen" +msgstr "" + +msgctxt "#30923" +msgid "Hoch auflösendes Video herunterladen" +msgstr "" + +msgctxt "#30924" msgid "Zur Warteschlange hinzufügen" msgstr "" diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index f391f8d..c994f9c 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -126,6 +126,14 @@ msgid "Scarica video" msgstr "" msgctxt "#30922" +msgid "Scarica video bassa risoluzione" +msgstr "" + +msgctxt "#30923" +msgid "Scarica video alta risoluzione" +msgstr "" + +msgctxt "#30924" msgid "Metti in coda" msgstr "" diff --git a/service.py b/service.py index 37c4545..a299ee4 100644 --- a/service.py +++ b/service.py @@ -1,6 +1,26 @@ # -*- coding: utf-8 -*- -# Copyright 2017 Leo Moll # +# MIT License +# +# Copyright (c) 2017-2018, Leo Moll +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. # -- Imports ------------------------------------------------ from __future__ import unicode_literals # ,absolute_import, division