Aktuelles TV-Programm in FHEM

Begonnen von Kuzl, 20 Oktober 2014, 20:41:43

Vorheriges Thema - Nächstes Thema

ch.eick

#1005
Zitat von: howi42 am 21 März 2019, 09:30:47
@ch.eick:
Das mit dem Abholen ist mir ja klar; deswegen will ich eigentlich sowas wie TV-Movie , etc. vermeiden.
Ich habe lokal eine DVBViewer/Server Installation laufen ( will ja schliesslich auch im Ausland meine Sender haben ),
dort ist ja alles schon lokal vorhanden.
Aber ich muss mich noch durch das API arbeiten, um gezielt die Informationen zu holen , die ich gerade brauche.
Im allgemeinen ist das das Info zu der Sendung , die jetzt laeuft; auf dem einen Sender,, der gerade eingestellt ist.
Alles andere, wie Info fuer eine bestimmte Zeit, kann ich solange ueber die Standard-EPG-Seite des DVBServers machen.

Ich habe auch den DVBviewer mit Lizenz. Hast Du schon etwas mit dem api und FHEM am laufen ? Dann schick mal die Erkenntnise und ich würde mir das mit dem TV Programm auch mal ansehen.
Das würde dann der Weg zu einem DVBviewer ,,Modul", das dann auch den EPG liefert.

Such mal nach DVBviewer im Forum, da gibt es schon was.

Gruß
    Christian
RPI4; Docker; CUNX; Eltako FSB61NP; SamsungTV H-Serie; Sonos; Vallox; Luxtronik; 3x FB7490; Stromzähler mit DvLIR; wunderground; Plenticore 10 mit BYD; EM410; SMAEM; Modbus TCP
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/ch.eick

TWART016

Hat jemand die Idee, wie ich anderen Programme, z.B. von Sky in FHEM bekomme?
https://www.sky.de/tvguide-7599?wkz=WHPS10&shurl=tvguide%20300

Von mir aus auch über eine andere Seite.

ch.eick

#1007
Zitat von: TWART016 am 26 März 2019, 16:53:18
Hat jemand die Idee, wie ich anderen Programme, z.B. von Sky in FHEM bekomme?
https://www.sky.de/tvguide-7599?wkz=WHPS10&shurl=tvguide%20300

Von mir aus auch über eine andere Seite.

Das sieht übel aus, weil auf der Seite alles in Java versteckt wurde....sorry, ich kenne da keinen Weg.

Und hier noch die Antwort von Sky:

Michael: kann man nicht DOwnloaden
Michael: TV Guide
Michael: ist im Revceiver Intigriert
Sie: Das ist aber nicht schön. Wird es das bald geben, wie bei anderen Anbietern auch?
Michael: Nein.
Michael: TV Guide bleibt dennoch bestehen und steht nicht zum Download bereit
Sie: Besten Dank
Michael: Vielen Dank für Ihre Anfrage, ich wünsche Ihnen noch einen schönen Tag.


Gruß
    Christian
RPI4; Docker; CUNX; Eltako FSB61NP; SamsungTV H-Serie; Sonos; Vallox; Luxtronik; 3x FB7490; Stromzähler mit DvLIR; wunderground; Plenticore 10 mit BYD; EM410; SMAEM; Modbus TCP
Contrib: https://svn.fhem.de/trac/browser/trunk/fhem/contrib/ch.eick

mumpitzstuff

Im Wiki ist beschrieben wie man sich selbst ein entsprechendes Programm zusammenstellen kann. Damit könnte man sich auch die Vorschau für Sky holen denke ich.

Das ist Variante 3 in Verbindung mit Variante 2.

Oder du verwendest Variante 1 und verwendest ein iFrame.

TWART016

Auch in den Dateien von Variante 2 und 3 sind kaum Infos zu Sky.

Ich hätte die Werte gerne in den Readings und nicht als iframe.

mumpitzstuff

In Variante 3 kann man sich beliebige Sender zusammen stellen.

http://www.webgrabplus.com/epg-channels#stc_14

Ich mache das auch so seit einiger Zeit. In Variante 2 muss man dann nur noch sky in die filterliste mit aufnehmen.

TWART016

Ich habe Schritt 3 soweit gemacht. Wie muss ich den channel definieren? Ist das richtig?
<channel update="i" site="sky.de" site_id="Sky Sport 6" xmltv_id="Sky Sport 6">Sky Sport 6</channel>

Muss ich jeden gewünschten Sender als Channel eintragen?

Anschließend ist Schritt 2 dran. Wo muss ich den Code eintragen? Auf dem OS?
perl /opt/fhem/tv/tv.pl dmy_TV download

Bei mir kommen da einige Fehler:
"my" variable $channelFilter masks earlier declaration in same scope at /opt/fhem/tv/tv.pl line 251.
"my" variable $timeAdjust masks earlier declaration in same scope at /opt/fhem/tv/tv.pl line 252.
"my" variable $redt masks earlier declaration in same scope at /opt/fhem/tv/tv.pl line 257.
Subroutine xmltv2epoch redefined at /opt/fhem/tv/tv.pl line 261.
Subroutine FmtDateTime redefined at /opt/fhem/tv/tv.pl line 280.
Subroutine filterText redefined at /opt/fhem/tv/tv.pl line 286.
Subroutine tvParse redefined at /opt/fhem/tv/tv.pl line 296.
Subroutine tvDownload redefined at /opt/fhem/tv/tv.pl line 453.
"my" variable $d masks earlier declaration in same scope at /opt/fhem/tv/tv.pl line 470.
"my" variable $m masks earlier declaration in same scope at /opt/fhem/tv/tv.pl line 471.


Wie muss ich die channelFilter definieren? Funktioniert es auch ohne Filter, also .* ?

mumpitzstuff

Die channels müssen alle separat eingetragen werden. Bei mir sieht die Datei dann insgesamt so aus:

<?xml version="1.0"?>
<settings>

  <!-- for detailed info about the settings see http://webgrabplus.com/documentation/configuration/webgrabconfigxml -->

  <filename>guide.xml</filename>
  <mode>n</mode>
  <postprocess grab="y" run="y">rex</postprocess>
  <user-agent>Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0</user-agent>
  <logging>on</logging>
  <retry time-out="15">5</retry>
  <timespan>6</timespan>
  <update>i</update>

  <!--
            Replace the next dummy channel entry with the channels you want.
                        You can look into the installed siteini.pack folder on your computer

            For the latest version,
            see http://webgrabplus.com/epg-channels for the available sites/channels
  -->

    <channel update="i" site="tvmovie.de" site_id="ard" xmltv_id="ARD">ARD</channel>
    <channel update="i" site="tvmovie.de" site_id="zdf" xmltv_id="ZDF">ZDF</channel>
    <channel update="i" site="tvmovie.de" site_id="rtl" xmltv_id="RTL">RTL</channel>
    <channel update="i" site="tvmovie.de" site_id="sat1" xmltv_id="SAT.1">SAT.1</channel>
    <channel update="i" site="tvmovie.de" site_id="pro-7" xmltv_id="PRO 7">PRO 7</channel>
    <channel update="i" site="tvmovie.de" site_id="rtl-ii" xmltv_id="RTL II">RTL II</channel>
    <channel update="i" site="tvmovie.de" site_id="kabel-1" xmltv_id="KABEL 1">KABEL 1</channel>
    <channel update="i" site="tvmovie.de" site_id="dmax" xmltv_id="DMAX">DMAX</channel>
    <channel update="i" site="tvmovie.de" site_id="vox" xmltv_id="VOX">VOX</channel>
    <channel update="i" site="tvmovie.de" site_id="sixx" xmltv_id="sixx">sixx</channel>
    <channel update="i" site="tvmovie.de" site_id="super-rtl" xmltv_id="Super RTL">Super RTL</channel>
    <channel update="i" site="tvmovie.de" site_id="kika" xmltv_id="KI.KA">KI.KA</channel>
    <channel update="i" site="tvmovie.de" site_id="rtl-nitro" xmltv_id="RTL NITRO">RTL NITRO</channel>
    <channel update="i" site="tvmovie.de" site_id="13th-street" xmltv_id="13TH STREET">13TH STREET</channel>
    <channel update="i" site="tvmovie.de" site_id="animal-planet" xmltv_id="ANIMAL PLANET">ANIMAL PLANET</channel>
    <channel update="i" site="tvmovie.de" site_id="axn" xmltv_id="AXN">AXN</channel>
    <channel update="i" site="tvmovie.de" site_id="discovery-channel" xmltv_id="Discovery Channel">Discovery Channel</channel>
    <channel update="i" site="tvmovie.de" site_id="fox" xmltv_id="FOX">FOX</channel>
    <channel update="i" site="tvmovie.de" site_id="history" xmltv_id="History">History</channel>
    <channel update="i" site="tvmovie.de" site_id="kabel-eins-classics" xmltv_id="kabel eins classics">kabel eins classics</channel>
    <channel update="i" site="tvmovie.de" site_id="kinowelt-tv" xmltv_id="Kinowelt TV">Kinowelt TV</channel>
    <channel update="i" site="tvmovie.de" site_id="n24" xmltv_id="N24">N24</channel>
    <channel update="i" site="tvmovie.de" site_id="nat-geo-wild" xmltv_id="Nat Geo Wild">Nat Geo Wild</channel>
    <channel update="i" site="tvmovie.de" site_id="national-geographic" xmltv_id="National Geographic">National Geographic</channel>
    <channel update="i" site="tvmovie.de" site_id="phoenix" xmltv_id="Phoenix">Phoenix</channel>
    <channel update="i" site="tvmovie.de" site_id="planet" xmltv_id="Planet">Planet</channel>
    <channel update="i" site="tvmovie.de" site_id="prosieben-fun" xmltv_id="ProSieben FUN">ProSieben FUN</channel>
    <channel update="i" site="tvmovie.de" site_id="prosieben-maxx" xmltv_id="ProSieben MAXX">ProSieben MAXX</channel>
    <channel update="i" site="tvmovie.de" site_id="rtl-crime" xmltv_id="RTL Crime">RTL Crime</channel>
    <channel update="i" site="tvmovie.de" site_id="rtl-living" xmltv_id="RTL Living">RTL Living</channel>
    <channel update="i" site="tvmovie.de" site_id="rtl-passion" xmltv_id="RTL Passion">RTL Passion</channel>
    <channel update="i" site="tvmovie.de" site_id="rtlplus" xmltv_id="RTLplus">RTLplus</channel>
    <channel update="i" site="tvmovie.de" site_id="servus-tv" xmltv_id="Servus TV">Servus TV</channel>
    <channel update="i" site="tvmovie.de" site_id="silverline" xmltv_id="Silverline">Silverline</channel>
    <channel update="i" site="tvmovie.de" site_id="spiegel-geschichte" xmltv_id="Spiegel Geschichte">Spiegel Geschichte</channel>
    <channel update="i" site="tvmovie.de" site_id="spiegel-tv-wissen" xmltv_id="Spiegel TV Wissen">Spiegel TV Wissen</channel>
    <channel update="i" site="tvmovie.de" site_id="syfy" xmltv_id="Syfy">Syfy</channel>
    <channel update="i" site="tvmovie.de" site_id="tlc" xmltv_id="TLC">TLC</channel>
    <channel update="i" site="tvmovie.de" site_id="tnt-comedy" xmltv_id="TNT Comedy">TNT Comedy</channel>
    <channel update="i" site="tvmovie.de" site_id="tnt-film" xmltv_id="TNT Film">TNT Film</channel>
    <channel update="i" site="tvmovie.de" site_id="tnt-serie" xmltv_id="TNT SERIE">TNT SERIE</channel>
    <channel update="i" site="tvmovie.de" site_id="zdfinfo" xmltv_id="ZDFinfo">ZDFinfo</channel>
    <channel update="i" site="tvmovie.de" site_id="a-und-e" xmltv_id="AE">A und E</channel>


</settings>


Meine rex.config.xml sieht so aus:
<?xml version="1.0" encoding="utf-8"?>
<!-- Configuration file for the REX (Re-arrange and Edit Xmltv) postprocessor of WebGrab+Plus
by Jan van Straaten, July 2012
WebGrab+Plus Version V1.1.1
-->
<!--  Introduction:
  The purpose of this postprocessor is to re-arrange and edit the xmltv file created by the grabber section of WebGrab+Plus.
  This can be useful or necessary if the EPG viewer of the PVR/Media-Centre used, or the xmltv importer it uses, does not support all the xmltv elements in the xmltv file created by WG++.
  It can:
  - Move the content of xmltv elements to other xmltv elements
  - Merge the content of several xmltv elements
  - Add comments/prefix/postfix text
  - Remove or create xmltv elements
  E.g.: If the PVR doesn't support import of credit elements (actors, directors etc.) it can add the content of them to the description and remove the original credit elements which are useless.
  Or , it can move the episode data to the beginning or end of the subtitle element
  Etc. ..
  Remark: This postprocessor is only fully effective if the xmltv input has a 'clean' xmltv structure in which the data is properly allocated to the elements. If that is the case depends on the EPG source site and the design of the SiteIni file . Some of the (e.g. customized) siteini files produce xmltv data that targets certain PVR/Media-Centre requirements already. In these cases this postprocessor is less effective /useful.-->

<settings>
  <!--xmltv file : The xmltv target file in which the updated data will be merged with the grabbed EPG.
Because of the incremental nature of the grabbing process this file must be different (name and/or path) from the target file of the grabbing as specified in WebGrab++.Config.xml <filename> !!
If omitted here or if by mistake the same file is specified, the file path will be changed to  C:\ProgramData\ServerCare\WebGrab\Rex\-->
  <filename>guide.xml</filename>

  <!-- Configuration of the elements: -->
<!-- Content and Values:-->
  <![CDATA[
  This is best explained in a step by step fashion:
  Suppose you want to move the actors to the end of the desciption. You then specify:
      <desc>'description'\n'actor'</desc>
  The result is the existing 'description' , followed by, on a newline,  the actor(s) separated by the standard WG++ element separator | .
  The result:
      <desc>This is the original description.
  Michael Douglas|Kim Basinger</desc>

  You probably don't like the | as separator between the actors, so you specify anther separator like this:
      <desc>'description'\n'actor(, )'</desc>
  The result:
      <desc>This is the original description.
      Michael Douglas, Kim Basinger</desc>

  You can make this prettier by adding some text to the actors addition:
      <desc>'description'\nActors: 'actor(, )'.</desc>
  The result:
      <desc>This is the original description.
      Actors: Michael Douglas, Kim Basinger.</desc>

  A small problem: Suppose the source xmltv show doesn't have any actors, then the result would be not so pretty:
      <desc>This is the original description.
      Actors: .</desc>
  To avoid that, the added text can be linked to the element it must be added to, like this:
      <desc>'description'{\nActors: 'actor(, )'.}</desc>
  Result with actors:
      <desc>This is the original description.
      Actors: Michael Douglas, Kim Basinger.</desc>
  And without actors:
      <desc>This is the original description.</desc>

  An example with some more elements:
      <desc>'description'{\n\tYear of production: 'productiondate'.}{\n\tProducer: 'producer(, )'.}{\n\tActors: 'actor(, )'.}</desc>
  Result:
      <desc>This is the original description.
        Year of production: 2002.
        Producer: Steven Spielberg.
        Actors: Michael Douglas, Kim Basinger.</desc>

  And another one:
      <sub-title>{Episode: 'episode'\t}'subtitle'</sub-title>
  Result:
      <sub-title>Episode: 3.2/12.1    The original subtitle</sub-title>

  You can also remove elements (but not the title!) from the xmltv listing by specifying an empty element, like this:
      <actor></actor>
  This will remove all <actor> elements
  And this:
      <credits></credits>
  Will remove the <credits> element, including all its child elements like <actor> , <producer> etc. ]]>
<![CDATA[
Summary of Content/Values:
1. Syntax
  - the content of the xmltv-target elements can be specified by means of a mixture of text and element-values.
  - the element-values must be entered by their element-name enclosed by ''
  - multiple value elements (like actor) will be converted to single value elements if the xmltv-target element is a single value element, like <desc>. The individual values will be listed with a (standard WG++ internal element separator) | as separator unless another separator is specified as follows:
'element-name(separator-string)' e.g. 'actor(, )'
  - text and element-names can be linked together by enclosing them by {}. This will ensure that, when the element in it is empty, everything between the {} is ignored. E.g. {\nProduced in : ('productiondate')}
- the text in the xmltv-target elements may contain the following simple formatting :
    - \n or \r to force a newline
    - \t to add a tab

2. The allowed xmltv-target elements (the ones in the target file specified above) are :
  <title>
  <sub-title>
  <desc>
  <date> = the xmltv element name containing the productiondate
  <star-rating>
  <review> (=optional new xmltv element)
  <director> e.g to add /substitute the (additional?) mdb-director
  <actor> e.g to add /substitute the (additional?) mdb-actor
- IMPORTANT! : any of the above listed xmltv-target elements that is specified in this allocation specification, replaces the existing xmltv element and its content!

3. Supported element-names (from the existing xmltv listing, name definitions as in Appendix D) :
  - 'title' 'description' 'starrating' 'subtitle' 'productiondate' 'category' 'director' 'actor' 'presenter' 'writer' 'composer' 'producer' 'rating' 'episode' 'review'  'subtitles' 'premiere' 'previously-shown' 'aspect' 'quality'

4. Also supported are the additional elements created by the MDB-postprocessor.
- Important : This MDB-postprocessor automatically makes use of this REX-postprocessor. In that case the REX-postprocessor uses the allocation specification from the MDB config file mdb.config.xml and ignores the specification entered here.
    - 'mdb-title'
(if used in the xmltv-target element <title> it will only be added if different from the existing xmltv title, see for more details mdb.config.xml)
    - 'mdb-starrating' 'mdb-description' 'mdb-plot' 'mdb-commentsummary' 'mdb-review'

5. Attributes (might need completion)
  - for each of the xmltv-elements the following attribute can be specified
          (if not specified, the existing one, if present in the xmltv, will be used) :
      - lang   for <title> and <desc> , default : no attribute
      - system   for <star-rating> , default : no attribute
      - type  for <review> , default: type="text"]]>

<!--An example setting -->
  <title lang="de">'title'</title>
  <sub-title lang="de">{Episode: 'episode' }'subtitle'</sub-title>
  <desc lang="de">'description'{\nProduced in: 'productiondate'. }{\nCategory: 'category(, )'. }{\nActors: 'actor(, )'}{\nDirector: 'director(, )'}{\nPresenter: 'presenter(, )'}</desc>
  <credits></credits>
  <episode-num></episode-num>
  <date></date>
  <category></category>
  <review>{Ratings: 'rating(, )'.}</review>
  <rating></rating>
</settings>




Danach solltest du erst mal prüfen, ob du die xml Datei ordnungsgemäß erzeugen kannst. Ruf dazu das hier auf:
/home/pi/.wg++/run.sh

Dann sollte sich nach langer langer Zeit (das dauert unter Umständen 3h!!!!) die Datei guide.xml in /home/pi/.wg++ erzeugt werden und zusätzlich dazu eine gekürzte guide.xml in  /home/pi/.wg++/rex.

Erst wenn du das hast, kannst du weiter machen.

TWART016

#1013
Das Problem war der Channel. Ich musste nur die zip Datei herunterladen und darin die XML öffnen.

Jetzt habe ich 4 Kanäle genommen und das Skript ausgeführt. In der guide.xml stehen wie gewünscht die Sendungen. Das mit der guide.xml könnte man vielleicht ins Wiki schreiben.
Somit ist Schritt 3 abgeschlossen.

Zu Schritt 2. Pakete sind installiert, Sub in 99_myUtils angelegt, dummy angelegt, Skript tv.pl auf Server erstellt

Wo muss ich das nun ausführen?
perl /opt/fhem/tv/tv.pl dmy_TV download


Edit: Woher muss ich die channelFilter nehmen?

mumpitzstuff

Nein. Den Download brauchst du nicht mehr. Du erzeugst dir jetzt die XML Datei selbst. Deshalb musst du nur noch das Parsen ausführen und vorher das Script anpassen.

Im sub tvParse findest du einen Pfad. Den passt du so an, das er auf deine erzeugte XML Datei zeigt, aber bitte die bereinigte aus dem rex Ordner. Diese muss für den fhem User natürlich irgendwie lesbar sein.

Außerdem muss diese Zeile angepasst werden:

my $channelFilter = qr/^(?:ARD|ZDF|Sat1|RTL|RTL2|Pro7|DMax|Vox|Kabel)/;

Hier müssen die Sendernamen rein, die du haben möchtest. Theoretisch kannst du da aber alles erst mal durch lassen, da du dir ja die Sender selbst zusammengestellt hast:

my $channelFilter = qr/.*/;

TWART016

Die guide.xml liegt hier

/home/user/.wg++/rex
-rw-rw-r-- 1 fhem dialout 295114 Mär 28 15:53 guide.xml


Daher sieht meine tv.pl so aus:
  my $obj = XML::Bare->new(file => '/home/user/.wg++/rex');

Muss bei dem foreach auch noch was geändert werden?
    foreach (@{forcearray($xml->{'tv'}{'programme'})})


Den Filter habe ich auf .* angepasst

Muss ich jetzt das komplette tv.pl ausführen oder nur über fhem das sub tvParse?

mumpitzstuff

Ich glaube nicht das der Pfad zu dieser Datei für fhem zugänglich ist. Es wäre vielleicht besser die Datei in ein Verzeichnis von fhem zu kopieren z.b. /opt/fhem/tv. Ansonsten sollte es passen.

TWART016

Ich habe jetzt beide Dateien in /opt/fhem/tv

-rw-r--r-- 1 fhem dialout 295114 Mär 29 11:41 guide.xml
-rwxr--r-- 1 fhem dialout   7593 Mär 29 11:48 tv.pl


Es genügt, wenn ich im Skript den Pfad mit eingebe?/opt/fhem/tv/guide

guide.xml wird gefunden?

Was muss ich jetzt wo ausführen?

mumpitzstuff

my $obj = XML::Bare->new(file => '/opt/fhem/tv/guide.xml');

Das muss im Script stehen.

Und danach probier mal sowas in der fhem Kommandozeile auszuführen:

{fhem("perl /opt/fhem/tv/tv.pl dmy_TV parse")}

TWART016

Zitat von: mumpitzstuff am 29 März 2019, 18:22:20
Und danach probier mal sowas in der fhem Kommandozeile auszuführen:

{fhem("perl /opt/fhem/tv/tv.pl dmy_TV parse")}
Ich bekomme das
Unknown command perl, try help.