Installing/using python scripts
Installing/using python scripts
Can python scripts from github be used with our Linux distros? How about this one: https://github.com/itorres/super3acasa? How shoud it be installed and started? I am not at all familiar with python...
- Roland -
- caseycullen
- Posts: 521
- Joined: Sat Dec 17, 2016 7:12 am
- Location: Madison, WI USA
- Contact:
Re: Installing/using python scripts
Generally you start python apps with "python3 appname.py" (or python appname.py for python 2); so in this case you'd cd to the directory containing tv3dl.py and then enter "python3 tv3dl.py". Many python apps require additional python libraries to run, in this case the app requires beautifulsoup4==4.4.1, lxml==3.6.0, PyYAML>=4.2b1 and requests>=2.20.0 (according to their "requirements" page on GitHub).Roland wrote: ↑Wed Sep 08, 2021 9:26 pm Can python scripts from github be used with our Linux distros? How about this one: https://github.com/itorres/super3acasa? How shoud it be installed and started? I am not at all familiar with python...
In Fienix, beautifulsoup4 is provided by the package "python3-bs4", lxml is provided by "python3-lxml", PyYAML is provided by python3-ruamel.yaml (I think) or python3-saneyaml, and requests is provided by python3-requests. You just need to make sure you have those packages installed in order to run the tv3dl.py app.
Python apps are highly compatible as long as we have all of the required libraries available.
-Casey
Re: Installing/using python scripts
Thank you very much for your advice!caseycullen wrote: ↑Thu Sep 09, 2021 6:41 pm Generally you start python apps with "python3 appname.py" (or python appname.py for python 2); so in this case you'd cd to the directory containing tv3dl.py and then enter "python3 tv3dl.py". Many python apps require additional python libraries to run, in this case the app requires beautifulsoup4==4.4.1, lxml==3.6.0, PyYAML>=4.2b1 and requests>=2.20.0 (according to their "requirements" page on GitHub).
In Fienix, beautifulsoup4 is provided by the package "python3-bs4", lxml is provided by "python3-lxml", PyYAML is provided by python3-ruamel.yaml (I think) or python3-saneyaml, and requests is provided by python3-requests. You just need to make sure you have those packages installed in order to run the tv3dl.py app.
But I was not able to find 'python3-ruamel.yaml' or 'python3-saneyaml' from the Fienix depot... Should they be there?
- Roland -
- caseycullen
- Posts: 521
- Joined: Sat Dec 17, 2016 7:12 am
- Location: Madison, WI USA
- Contact:
Re: Installing/using python scripts
I was able to install PyYAML with pip3... But when I try to run the script as you adviced, I get this:
> python3 tv3dl.py
Traceback (most recent call last):
File "tv3dl.py", line 9, in <module>
import yaml
ModuleNotFoundError: No module named 'yaml'
- Roland -
- caseycullen
- Posts: 521
- Joined: Sat Dec 17, 2016 7:12 am
- Location: Madison, WI USA
- Contact:
Re: Installing/using python scripts
Try installing python3-yaml from the Fienix repository.Roland wrote: ↑Fri Sep 10, 2021 7:04 pmI was able to install PyYAML with pip3... But when I try to run the script as you adviced, I get this:
> python3 tv3dl.py
Traceback (most recent call last):
File "tv3dl.py", line 9, in <module>
import yaml
ModuleNotFoundError: No module named 'yaml'
Re: Installing/using python scripts
Thanks! After installing that component the script started to work. But is does not seem to find anything to download, it just goes through a long list of dirs:caseycullen wrote: ↑Mon Sep 13, 2021 7:20 pm Try installing python3-yaml from the Fienix repository.
Code: Select all
Starting
tv3dl.py:52: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
self._config = yaml.load(f)
Getting chapters for 10+2
No tag with title "Vídeos" found
Getting chapters for Artús i els vailets de la Taula Rodona
No tag with title "Vídeos" found
Getting chapters for Asha
No tag with title "Vídeos" found
Getting chapters for Avatar, la llegenda de la Korra
No tag with title "Vídeos" found
Getting chapters for Avui aprenem
No tag with title "Vídeos" found
Getting chapters for Bestial!
No tag with title "Vídeos" found
Getting chapters for Bola & Bill
No tag with title "Vídeos" found
...
Code: Select all
dirs:
base: /nas/4TB2/Media/In/tv3
download: /nas/4TB2/Media/In/tv3/d
index: /nas/4TB2/Media/In/tv3/index
publish: /nas/4TB2/Media/Video/Infantil
:publish:
"Doraemon, el gat còsmic":
"Doraemon": "Doraemon, el gat còsmic"
"Monster allergy":
"Monster Allergy": "Monster allergy"
"Una mà de contes":
"Ua man de condes": "Una mà de contes"
"Els Dalton":
"El llibre de la selva":
"Bob, el manetes":
"Bob el manetes": "Bob, el manetes"
"Bob, el manetes: a peu d'obra": "Bob, el manetes"
"Bob, el manetes: el Llampec al rescat": "Bob, el manetes"
"Marsupilami":
"Rekkit, el conill màgic":
"Rekkit rabbit": "Rekkit, el conill màgic"
"L'hora del Timmy":
"Geronimo Stilton":
"La vaca Connie":
"MIC":
"Mic": "MIC"
"Xilòfon i Mic en capsa": "MIC"
"Les noves aventures de Peter Pan":
"Zoobabu":
"Els caçadors d'elements":
"Els germans Kratt":
"Invizimals":
"LazyTown - Vilamandra":
"El xai Shaun":
"Rovelló":
"El carnaval de la Ventafocs (Rovelló)": "Rovelló"
"Teo":
"Monstres supersans":
"La vaca Connie":
"Les misterioses ciutats d'or":
"La casa d'Anubis":
"La Casa d'Anubis": "La casa d'Anubis"
Code: Select all
https://www.ccma.cat/tv3/alacarta/transmissions-esportives/holanda/video/6117256/
Code: Select all
#!/usr/bin/env bash
IMAGE_NAME=itorres/tv3dl
COMMAND=/usr/src/app/tv3dl.py
VOLUME=$(awk -F ': ' '/base:/ {print $2}' config.yaml)
function exec_build {
docker build -t itorres/tv3dl .
}
function exec_run {
docker run --rm -ti -v $VOLUME:$VOLUME -v $(pwd):/usr/src/app ${IMAGE_NAME} $COMMAND
}
while getopts ":bc" opt; do
case $opt in
c)
exec_build
;;
b)
COMMAND=bash
;;
esac
done
docker images | grep -q ${IMAGE_NAME} || exec_build
exec_run
Code: Select all
Fienix:~/Scripts/super3acasa-master$ '/home/roland/Scripts/super3acasa-master/run.sh'
/home/roland/Scripts/super3acasa-master/run.sh: line 22: docker: command not found
/home/roland/Scripts/super3acasa-master/run.sh: line 6: docker: command not found
/home/roland/Scripts/super3acasa-master/run.sh: line 9: docker: command not found
- Roland -
- caseycullen
- Posts: 521
- Joined: Sat Dec 17, 2016 7:12 am
- Location: Madison, WI USA
- Contact:
Re: Installing/using python scripts
I took a closer look at the tv3dl source code, and it looks like ccma.cat has made changes that broke the app. For example, I found several hard-coded URLs that aren't valid addresses anymore, like "https://www.ccma.cat/tv3/alacarta/programes/" and "http://dinamics.ccma.cat/pvideo/media.jsp".Roland wrote: ↑Mon Sep 27, 2021 9:40 amThanks! After installing that component the script started to work. But is does not seem to find anything to download, it just goes through a long list of dirs:caseycullen wrote: ↑Mon Sep 13, 2021 7:20 pm Try installing python3-yaml from the Fienix repository.
I wonder if the config file (Yaml.config) is out of date, or configured too specifically:Code: Select all
Starting tv3dl.py:52: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. self._config = yaml.load(f) Getting chapters for 10+2 No tag with title "Vídeos" found Getting chapters for Artús i els vailets de la Taula Rodona No tag with title "Vídeos" found Getting chapters for Asha No tag with title "Vídeos" found Getting chapters for Avatar, la llegenda de la Korra No tag with title "Vídeos" found Getting chapters for Avui aprenem No tag with title "Vídeos" found Getting chapters for Bestial! No tag with title "Vídeos" found Getting chapters for Bola & Bill No tag with title "Vídeos" found ...
How should it be modified to 'find' this video:Code: Select all
dirs: base: /nas/4TB2/Media/In/tv3 download: /nas/4TB2/Media/In/tv3/d index: /nas/4TB2/Media/In/tv3/index publish: /nas/4TB2/Media/Video/Infantil :publish: "Doraemon, el gat còsmic": "Doraemon": "Doraemon, el gat còsmic" "Monster allergy": "Monster Allergy": "Monster allergy" "Una mà de contes": "Ua man de condes": "Una mà de contes" "Els Dalton": "El llibre de la selva": "Bob, el manetes": "Bob el manetes": "Bob, el manetes" "Bob, el manetes: a peu d'obra": "Bob, el manetes" "Bob, el manetes: el Llampec al rescat": "Bob, el manetes" "Marsupilami": "Rekkit, el conill màgic": "Rekkit rabbit": "Rekkit, el conill màgic" "L'hora del Timmy": "Geronimo Stilton": "La vaca Connie": "MIC": "Mic": "MIC" "Xilòfon i Mic en capsa": "MIC" "Les noves aventures de Peter Pan": "Zoobabu": "Els caçadors d'elements": "Els germans Kratt": "Invizimals": "LazyTown - Vilamandra": "El xai Shaun": "Rovelló": "El carnaval de la Ventafocs (Rovelló)": "Rovelló" "Teo": "Monstres supersans": "La vaca Connie": "Les misterioses ciutats d'or": "La casa d'Anubis": "La Casa d'Anubis": "La casa d'Anubis"
There is also an ordinary script included with the python ones:Code: Select all
https://www.ccma.cat/tv3/alacarta/transmissions-esportives/holanda/video/6117256/
If I try to run it in terminal, I get this kind of error messages:Code: Select all
#!/usr/bin/env bash IMAGE_NAME=itorres/tv3dl COMMAND=/usr/src/app/tv3dl.py VOLUME=$(awk -F ': ' '/base:/ {print $2}' config.yaml) function exec_build { docker build -t itorres/tv3dl . } function exec_run { docker run --rm -ti -v $VOLUME:$VOLUME -v $(pwd):/usr/src/app ${IMAGE_NAME} $COMMAND } while getopts ":bc" opt; do case $opt in c) exec_build ;; b) COMMAND=bash ;; esac done docker images | grep -q ${IMAGE_NAME} || exec_build exec_run
What is that 'docker' command which seems to be missing?Code: Select all
Fienix:~/Scripts/super3acasa-master$ '/home/roland/Scripts/super3acasa-master/run.sh' /home/roland/Scripts/super3acasa-master/run.sh: line 22: docker: command not found /home/roland/Scripts/super3acasa-master/run.sh: line 6: docker: command not found /home/roland/Scripts/super3acasa-master/run.sh: line 9: docker: command not found
Docker is a type of container, kind of like snap. The script that you referenced packages the application in a Docker container, which isn't helpful for the problem we're running into.
Hmm... have you tried asking sebaro if ViewTube+ may be able to support ccma.cat videos? If not, you could try asking at sebaro.pro/contact/. This would make the videos playable in Interweb or Arctic Fox.
Otherwise, you may be able to use youtube-dl with a command like "youtube-dl -f 480p -o - https://www.ccma.cat/tv3/alacarta/trans ... o/6117256/ | vlc". I'm not sure if it will work, but youtube-dl works for several video/streaming sites.
Re: Installing/using python scripts
Ok, thanks for checking it... We can forget that script.caseycullen wrote: ↑Mon Sep 27, 2021 7:27 pm I took a closer look at the tv3dl source code, and it looks like ccma.cat has made changes that broke the app. For example, I found several hard-coded URLs that aren't valid addresses anymore, like "https://www.ccma.cat/tv3/alacarta/programes/" and "http://dinamics.ccma.cat/pvideo/media.jsp".
I have ViewTube+ already installed and it does not support ccma.cat. Sebaro added earlier one other site to ViewTube+ on my demand... I'm not sure if I dare to ask him to add another one !-)Hmm... have you tried asking sebaro if ViewTube+ may be able to support ccma.cat videos? If not, you could try asking at sebaro.pro/contact/. This would make the videos playable in Interweb or Arctic Fox.
To my surprice, youtube-dl indeed works with ccma.cat. It did not come to my mind to test it as I thought it works only with Youtube.Otherwise, you may be able to use youtube-dl with a command like "youtube-dl -f 480p -o - https://www.ccma.cat/tv3/alacarta/trans ... o/6117256/ | vlc". I'm not sure if it will work, but youtube-dl works for several video/streaming sites.
Problem solved... Thank you very much for your help !-)
BTW. I noticed yesterday that the "Video DownloadHelper" plugin can be installed manually on the PaleMoon family of browsers! It did not succeed to download videos from ccma.cat but it worked with some other sites. In your future versions of Fienix, it might not be a bad idea to preinstall it on the browsers...
Last edited by Roland on Mon Sep 27, 2021 10:14 pm, edited 1 time in total.
- Roland -
- caseycullen
- Posts: 521
- Joined: Sat Dec 17, 2016 7:12 am
- Location: Madison, WI USA
- Contact:
Re: Installing/using python scripts
Nice, I'm glad we found a solution that works for you! I use youtube-dl for Twitch, too. It's more versatile than the name would lead one to believe!
Thanks for the suggestion; I'll check it out.Roland wrote: ↑Mon Sep 27, 2021 8:07 pm BTW. I noticed yesterday that the "Video DownloadHelper" plugin can be installed manually on the PaleMoon family of browsers! It did not succeed to download videos from ccma.cat but it worked with some other sites. In your future versions of Fienix, it might not be bad idea to preinstall it on the browsers...
-Casey