Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with Jellyfin and strm files on Raspberry Pi3b+ #5

Closed
CrazyWolf13 opened this issue Apr 14, 2023 · 46 comments
Closed

issue with Jellyfin and strm files on Raspberry Pi3b+ #5

CrazyWolf13 opened this issue Apr 14, 2023 · 46 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@CrazyWolf13
Copy link

CrazyWolf13 commented Apr 14, 2023

I get this error when i execute the cron job, but I think I installed the sanitize filename via requirements.txt ?

Traceback (most recent call last):
File "/opt/ytdlp2STRM/cli.py", line 8, in
from sanitize_filename import sanitize
ModuleNotFoundError: No module named 'sanitize_filename'

@fe80Grau edit:

@CrazyWolf13
Copy link
Author

if i run pip install sanitize_filename it says already installed.

Maybe there is an error in cli.py?

@CrazyWolf13
Copy link
Author

CrazyWolf13 commented Apr 14, 2023

Running make_files_strm with ['youtube', 'stream'] params
Traceback (most recent call last):
File "/opt/ytdlp2STRM/cli.py", line 292, in
r = getattr(sys.modules[name], method)(*params)
File "/opt/ytdlp2STRM/cli.py", line 186, in make_files_strm
for youtube_channel in channels():
File "/opt/ytdlp2STRM/cli.py", line 46, in channels
channels = json.load(f)
File "/usr/lib/python3.9/json/init.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 5 column 5 (char 69)

After installing via sudo pip install sanitize_filename there was another error, any ideas on this?
@fe80Grau

@fe80Grau
Copy link
Owner

Hi @CrazyWolf13 . It seems the code breaks when reading channel_list.json , "expecting ',' delimiter" says this error
Can you share your channel_list.json?

@CrazyWolf13
Copy link
Author

Hi @CrazyWolf13 . It seems the code breaks when reading channel_list.json , "expecting ',' delimiter" says this error Can you share your channel_list.json?

Well, that was quite embarrassing, I missed out on a ","

But after fixing the "," issue is still got an error:

Running make_files_strm with ['youtube', 'stream'] params
Preparing channel /user/xbox
Clearing /mnt/Seagate/Youtube-STRM/@xbox [False] folder...
Inflating nfo file..
No poster detected
No landscape detected
Traceback (most recent call last):
File "/opt/ytdlp2STRM/cli.py", line 292, in
r = getattr(sys.modules[name], method)(*params)
File "/opt/ytdlp2STRM/cli.py", line 240, in make_files_strm
inflate_nfo("youtube", {'youtube_channel' : "channel/{}".format(channel_id), 'youtube_channel_folder' : youtube_channel_folder})
File "/opt/ytdlp2STRM/cli.py", line 162, in inflate_nfo
os.remove("{}.description".format(channel_name))
FileNotFoundError: [Errno 2] No such file or directory: '/bin/sh: 1: yt-dlp: not found.description'

@fe80Grau
Copy link
Owner

fe80Grau commented Apr 14, 2023

Mmmmm with /user/xbox channel:

Clearing /mnt/Seagate/Youtube-STRM/@xbox [False] folder...
This False is not normal, the spected output have the ID channel:

Clearing /media/Youtube/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g] folder...
Can you run the next command and paste the output here?

yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --restrict-filenames --ignore-errors --no-warnings --playlist-start 1 --playlist-end 1 --print channel_url https://www.youtube.com/user/xbox

tell me your OS and yt-dlp version maybe helps to clear this problem.

@CrazyWolf13
Copy link
Author

CrazyWolf13 commented Apr 14, 2023

Mmmmm with /user/xbox channel:

Clearing /mnt/Seagate/Youtube-STRM/@xbox [False] folder...
This False is not normal, the spected output have the ID channel:

Clearing /media/Youtube/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g] folder...
Can you run this command and paste here the output?

yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --restrict-filenames --ignore-errors --no-warnings --playlist-start 1 --playlist-end 1 --print channel_url https://www.youtube.com/user/xbox

tell me your OS and yt-dlp version maybe helps to clear this problem.

I'm running Raspian a Raspberry Pi3b+
The command seems tu run successfully, it prints out one url just fine.

https://www.youtube.com/channel/UCjBp_7RuDBUYbd1LegWEJ8g

yt-dlp is on version: stable@2023.03.04

pip install -U yt-dlp

"Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: yt-dlp in ./.local/lib/python3.9/site-packages (2023.3.4)
Requirement already satisfied: websockets in ./.local/lib/python3.9/site-packages (from yt-dlp) (10.4)
Requirement already satisfied: certifi in ./.local/lib/python3.9/site-packages (from yt-dlp) (2022.12.7)
Requirement already satisfied: pycryptodomex in ./.local/lib/python3.9/site-packages (from yt-dlp) (3.17)
Requirement already satisfied: brotli in ./.local/lib/python3.9/site-packages (from yt-dlp) (1.0.9)
Requirement already satisfied: mutagen in ./.local/lib/python3.9/site-packages (from yt-dlp) (1.46.0)"

@fe80Grau
Copy link
Owner

Pull last commit in main, and paste here output. I need to see the string of yt-dlp command builded and them output. I think that is returns False allways when subprocess.getouput(command) is executed, in that case it's probably a permissions problem, the user that runs python script needs permission to run yt-dlp command. Is this so now?

@CrazyWolf13
Copy link
Author

Pull last commit in main, and paste here output. I need to see the string of yt-dlp command builded and them output. I think that is returns False allways when subprocess.getouput(command) is executed, in that case it's probably a permissions problem, the user that runs python script needs permission to run yt-dlp command. Is this so now?

Sorry for the delay, had to get some rest.

I don't think I have changed a lot in permissions so they "should" be default raspian permissions.
Here the output:
cd /opt/ytdlp2STRM && /usr/bin/python3 /opt/ytdlp2STRM/cli.py --m make_files_strm --p youtube,stream
15/04/2023 08:15:28
Running make_files_strm with ['youtube', 'stream'] params
Preparing channel /user/xbox
Command:
yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --restrict-filenames --ignore-errors --no-warnings --playlist-start 1 --playlist-end 1 --print channel_url https://www.youtube.com/user/xbox
Output:
['https://www.youtube.com/channel/UCjBp_7RuDBUYbd1LegWEJ8g']
Channel ID value: UCjBp_7RuDBUYbd1LegWEJ8g
Clearing /mnt/Seagate/Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g] folder...
Inflating nfo file..

Now it seems stuck. Hasn't changed since minutes.

@CrazyWolf13
Copy link
Author

CrazyWolf13 commented Apr 15, 2023

Seems to have finished now:

Inflating nfo..

Traceback (most recent call last):
File "/opt/ytdlp2STRM/cli.py", line 301, in
r = getattr(sys.modules[name], method)(*params)
File "/opt/ytdlp2STRM/cli.py", line 267, in make_files_strm
video_name = "{} [{}]".format(str(line).rstrip().split(';')[1], video_id)
IndexError: list index out of range

There are three folders:

  • Youtube-STRM/@leagueoflegends [UC2t5bjwHdUX4vM2g8TRDq5g]
    Here is a tvshow.nfo

  • Youtube-STRM/@xbox [False]
    Here is another tvshow.nfo

  • Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g]
    Here are a bunch of .strm files named like videos.

@fe80Grau
Copy link
Owner

You have channel id now, this is so good. STRM files can be played with Jellyfin , VLC or other video streaming service.
Check your config, the script only save videos in last N days and N video limit that you config, if the channel doesn't have a video in las N days doesn't show nothing only tvshow.nfo

For example the last video in leagueoflegends channel is from 3 weeks ago, by default i set 60 days old and 100 limit videos to check. Evaluate if you change this.

By the way, i added some prints to debug in last commit

**Delete Youtube-STRM/ [UC2t5bjwHdUX4vM2g8TRDq5g] and Youtube-STRM/ [Falso] are bugs.. I checked my folder and i found fails folder, maybe yt-dlp fails sometimes or after a lot of use. I will check this with more patience

@CrazyWolf13
Copy link
Author

You have channel id now, this is so good. STRM files can be played with Jellyfin , VLC or other video streaming service. Check your config, the script only save videos in last N days and N video limit that you config, if the channel doesn't have a video in las N days doesn't show nothing only tvshow.nfo

For example the last video in leagueoflegends channel is from 3 weeks ago, by default i set 60 days old and 100 limit videos to check. Evaluate if you change this.

By the way, i added some prints to debug in last commit

**Delete Youtube-STRM/ [UC2t5bjwHdUX4vM2g8TRDq5g] and Youtube-STRM/ [Falso] are bugs.. I checked my folder and i found fails folder, maybe yt-dlp fails sometimes or after a lot of use. I will check this with more patience

Thank you for the reply.
So it should work more or less?
But what was the last traceback error?

@fe80Grau
Copy link
Owner

In line 264, when lines is blank (te command output fails o something), the script is entering in for and breaks, i added one line to check if line is not blank. Pull last commit and run it again.

@CrazyWolf13
Copy link
Author

cd /opt/ytdlp2STRM && /usr/bin/python3 /opt/ytdlp2STRM/cli.py --m make_files_strm --p youtube,stream
15/04/2023 11:00:13
Running make_files_strm with ['youtube', 'stream'] params
Preparing channel /user/xbox
Command:
yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --restrict-filenames --ignore-errors --no-warnings --playlist-start 1 --playlist-end 1 --print channel_url https://www.youtube.com/user/xbox
Output:
['https://www.youtube.com/channel/UCjBp_7RuDBUYbd1LegWEJ8g']
Channel ID value: UCjBp_7RuDBUYbd1LegWEJ8g
Clearing /mnt/Seagate/Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g] folder...
Inflating nfo file..
Command:
yt-dlp https://www.youtube.com/channel/UCjBp_7RuDBUYbd1LegWEJ8g --list-thumbnails --restrict-filenames --ignore-errors --no-warnings --playlist-items 0
Poster found
Landscape found
Channel ID UCjBp_7RuDBUYbd1LegWEJ8g
Command yt-dlp https://www.youtube.com/channel/UCjBp_7RuDBUYbd1LegWEJ8g --compat-options no-youtube-unavailable-videos --print "%(channel)s" --restrict-filenames --ignore-errors --no-warnings --playlist-items 1 --compat-options no-youtube-channel-redirect --no-warnings
Output:
Xbox
Command
yt-dlp https://www.youtube.com/channel/UCjBp_7RuDBUYbd1LegWEJ8g --write-description --playlist-items 0 --output "Xbox.description" > /dev/null 2>&1 && cat "Xbox.description"
Output

Processing videos in channel
Command
yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --print "%(id)s;%(title)s" --dateafter today-10days --playlist-start 1 --playlist-end 100 --ignore-errors --no-warnings https://www.youtube.com/user/xbox
Video encontrado
{'video_id': 'Ut9PJ1O0H50', 'video_name': 'Ghostwire: Tokyo & Ubisoft+, come and get it! | This Week on Xbox [Ut9PJ1O0H50]'}
Video encontrado
{'video_id': 'JdPeq_p1Uxo', 'video_name': 'Classics Vehicle Pack #1 Trailer | Dakar Desert Rally [JdPeq_p1Uxo]'}
Video encontrado
{'video_id': 'TpgcMzUJ8iA', 'video_name': 'Killer Frequency | Date Reveal Trailer & Console Announcement [TpgcMzUJ8iA]'}
Video encontrado
{'video_id': 'ZpYQbp1aewU', 'video_name': "Them's Fightin' Herds - Stronghoof Release Trailer [ZpYQbp1aewU]"}
Video encontrado
{'video_id': 'Q43NmbhoJD0', 'video_name': 'GLADIATORS – The Latest Season [Q43NmbhoJD0]'}
Video encontrado
{'video_id': '377lsCtAAAU', 'video_name': '4 Years and Counting! Uncover the Surprises of the Latest Update in World of Warships: Legends [377lsCtAAAU]'}
Video encontrado
{'video_id': '4LpM5Yc9-Io', 'video_name': 'ONE PIECE ODYSSEY — Reunion of Memories Teaser Trailer [4LpM5Yc9-Io]'}
Video encontrado
{'video_id': '5dA19r3NTys', 'video_name': 'Disney Dreamlight Valley – Pride of the Valley Update Trailer [5dA19r3NTys]'}
Video encontrado
{'video_id': 'xHSufRxcYtM', 'video_name': 'Battlefield 2042 | Season 4: Leviathan Rising Event Trailer [xHSufRxcYtM]'}
Video encontrado
{'video_id': 'YO2uCa65PwU', 'video_name': 'Two Point Campus Spring Update! [YO2uCa65PwU]'}
Video encontrado
{'video_id': 'levsLa-NLWI', 'video_name': 'Hammerwatch II - Announcement Trailer [levsLa-NLWI]'}
Video encontrado
{'video_id': 'KkyMgcwOmHI', 'video_name': 'Redfall - The Deadeye | Jacob Hero Trailer [KkyMgcwOmHI]'}
Video encontrado
{'video_id': 'iykBCAV8as8', 'video_name': 'Redfall - The Telekinetic Threat | Layla Hero Trailer [iykBCAV8as8]'}
Video encontrado
{'video_id': 'kcCRpcx3MnU', 'video_name': "Who says supernatural demons can't also be considered adorable? [kcCRpcx3MnU]"}
Video encontrado
{'video_id': 'pCflI9qLDX0', 'video_name': 'Custom colors for your custom controller! - New Elite Series 2 colors available now [pCflI9qLDX0]'}
Video encontrado
{'video_id': 'sphK_7smY90', 'video_name': 'Saving the turtles that you spawned in a tree from said tree is an unparalleled feeling 🤌 [sphK_7smY90]'}
Video encontrado
{'video_id': 'KkyMgcwOmHI', 'video_name': 'Redfall - The Deadeye | Jacob Hero Trailer [KkyMgcwOmHI]'}
Video encontrado
{'video_id': 'PqevZn5MOaw', 'video_name': 'Hi-Fi RUSH | Tango Remix Trailer [PqevZn5MOaw]'}
Video encontrado
{'video_id': 'iykBCAV8as8', 'video_name': 'Redfall - The Telekinetic Threat | Layla Hero Trailer [iykBCAV8as8]'}
Video encontrado
{'video_id': 'kcCRpcx3MnU', 'video_name': "Who says supernatural demons can't also be considered adorable? [kcCRpcx3MnU]"}
Video encontrado
{'video_id': 'pCflI9qLDX0', 'video_name': 'Custom colors for your custom controller! - New Elite Series 2 colors available now [pCflI9qLDX0]'}
Video encontrado
{'video_id': 'sphK_7smY90', 'video_name': 'Saving the turtles that you spawned in a tree from said tree is an unparalleled feeling 🤌 [sphK_7smY90]'}
Video encontrado
{'video_id': 'uFPePTgg_bo', 'video_name': 'Sniper Elite 5 – Death From Above Weapon & Skin Pack [uFPePTgg_bo]'}
Video encontrado
{'video_id': 'kcCRpcx3MnU', 'video_name': "Who says supernatural demons can't also be considered adorable? [kcCRpcx3MnU]"}
Video encontrado
{'video_id': 'pCflI9qLDX0', 'video_name': 'Custom colors for your custom controller! - New Elite Series 2 colors available now [pCflI9qLDX0]'}
Video encontrado
{'video_id': 'sphK_7smY90', 'video_name': 'Saving the turtles that you spawned in a tree from said tree is an unparalleled feeling 🤌 [sphK_7smY90]'}
Preparing channel @leagueoflegends
Command:
yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --restrict-filenames --ignore-errors --no-warnings --playlist-start 1 --playlist-end 1 --print channel_url https://www.youtube.com/@leagueoflegends/videos
Output:
['https://www.youtube.com/channel/UC2t5bjwHdUX4vM2g8TRDq5g']
Channel ID value: UC2t5bjwHdUX4vM2g8TRDq5g
Clearing /mnt/Seagate/Youtube-STRM/@leagueoflegends [UC2t5bjwHdUX4vM2g8TRDq5g] folder...
Inflating nfo file..
Command:
yt-dlp https://www.youtube.com/channel/UC2t5bjwHdUX4vM2g8TRDq5g --list-thumbnails --restrict-filenames --ignore-errors --no-warnings --playlist-items 0
Poster found
Landscape found
Channel ID UC2t5bjwHdUX4vM2g8TRDq5g
Command yt-dlp https://www.youtube.com/channel/UC2t5bjwHdUX4vM2g8TRDq5g --compat-options no-youtube-unavailable-videos --print "%(channel)s" --restrict-filenames --ignore-errors --no-warnings --playlist-items 1 --compat-options no-youtube-channel-redirect --no-warnings
Output:
League of Legends
Command
yt-dlp https://www.youtube.com/channel/UC2t5bjwHdUX4vM2g8TRDq5g --write-description --playlist-items 0 --output "League of Legends.description" > /dev/null 2>&1 && cat "League of Legends.description"
Output

Processing videos in channel
Command
yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --print "%(id)s;%(title)s" --dateafter today-10days --playlist-start 1 --playlist-end 100 --ignore-errors --no-warnings https://www.youtube.com/@leagueoflegends/videos
Preparing channel @linustechtips
Command:
yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --restrict-filenames --ignore-errors --no-warnings --playlist-start 1 --playlist-end 1 --print channel_url https://www.youtube.com/@linustechtips/videos
Output:
['https://www.youtube.com/channel/UCXuqSBlHAE6Xw-yeJA0Tunw']
Channel ID value: UCXuqSBlHAE6Xw-yeJA0Tunw
Clearing /mnt/Seagate/Youtube-STRM/@linustechtips [UCXuqSBlHAE6Xw-yeJA0Tunw] folder...
Inflating nfo file..
Command:
yt-dlp https://www.youtube.com/channel/UCXuqSBlHAE6Xw-yeJA0Tunw --list-thumbnails --restrict-filenames --ignore-errors --no-warnings --playlist-items 0
Poster found
Landscape found
Channel ID UCXuqSBlHAE6Xw-yeJA0Tunw
Command yt-dlp https://www.youtube.com/channel/UCXuqSBlHAE6Xw-yeJA0Tunw --compat-options no-youtube-unavailable-videos --print "%(channel)s" --restrict-filenames --ignore-errors --no-warnings --playlist-items 1 --compat-options no-youtube-channel-redirect --no-warnings
Output:
Linus Tech Tips
Command
yt-dlp https://www.youtube.com/channel/UCXuqSBlHAE6Xw-yeJA0Tunw --write-description --playlist-items 0 --output "Linus Tech Tips.description" > /dev/null 2>&1 && cat "Linus Tech Tips.description"
Output

Processing videos in channel
Command
yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --print "%(id)s;%(title)s" --dateafter today-10days --playlist-start 1 --playlist-end 100 --ignore-errors --no-warnings https://www.youtube.com/@linustechtips/videos
Video encontrado
{'video_id': '1vpepaQ-VQQ', 'video_name': 'STOP Buying ANDROID TV Boxes! [1vpepaQ-VQQ]'}
Video encontrado
{'video_id': 'nkh9VGCY8as', 'video_name': 'I’m Dreading this Review – RTX 4070 [nkh9VGCY8as]'}
Video encontrado
{'video_id': 'g7oNuP83VXs', 'video_name': 'The Amazon Basics CPU Cooler [g7oNuP83VXs]'}
Video encontrado
{'video_id': 'LVkqK4bl1Gw', 'video_name': 'If you can fix this PC, it’s yours! [LVkqK4bl1Gw]'}
Video encontrado
{'video_id': 'nLIp4wd0oXs', 'video_name': 'This Makes Hacking TOO Easy - Flipper Zero [nLIp4wd0oXs]'}
Video encontrado
{'video_id': '1ugJ1BJx0HE', 'video_name': 'The SCAM of Wireless ESD Straps - Feat. ElectroBOOM [1ugJ1BJx0HE]'}
Video encontrado
{'video_id': 'k7wnNt65lcE', 'video_name': 'Can a Gaming PC Survive the North Pole? [k7wnNt65lcE]'}
Video encontrado
{'video_id': 'nj4gn7od0jY', 'video_name': "It's the Best Gaming CPU on the Planet.. AND I'M MAD. - Ryzen 7 7800X3D Review [nj4gn7od0jY]"}
Preparing channel list-PLbZIPy20-1pN7mqjckepWF78ndb6ci_qi
Command:
yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --restrict-filenames --ignore-errors --no-warnings --playlist-start 1 --playlist-end 1 --print channel_url https://www.youtube.com/playlist?list=PLbZIPy20-1pN7mqjckepWF78ndb6ci_qi
Output:
['https://www.youtube.com/channel/UCQ5kHOKpF3-1_UCKaqXARRg']
Channel ID value: UCQ5kHOKpF3-1_UCKaqXARRg
Clearing /mnt/Seagate/Youtube-STRM/list-PLbZIPy20-1pN7mqjckepWF78ndb6ci_qi [UCQ5kHOKpF3-1_UCKaqXARRg] folder...
Inflating nfo file..
Command:
yt-dlp https://www.youtube.com/channel/UCQ5kHOKpF3-1_UCKaqXARRg --list-thumbnails --restrict-filenames --ignore-errors --no-warnings --playlist-items 0
Poster found
Landscape found
Channel ID UCQ5kHOKpF3-1_UCKaqXARRg
Command yt-dlp https://www.youtube.com/channel/UCQ5kHOKpF3-1_UCKaqXARRg --compat-options no-youtube-unavailable-videos --print "%(playlist_title)s" --playlist-items 1 --restrict-filenames --ignore-errors --no-warnings --compat-options no-youtube-channel-redirect --no-warnings
Output:
OneRepublicVEVO - Videos
Command
yt-dlp https://www.youtube.com/channel/UCQ5kHOKpF3-1_UCKaqXARRg --write-description --playlist-items 0 --output "OneRepublicVEVO - Videos.description" > /dev/null 2>&1 && cat "OneRepublicVEVO - Videos.description"
Output

Processing videos in channel
Command
yt-dlp --compat-options no-youtube-channel-redirect --compat-options no-youtube-unavailable-videos --print "%(id)s;%(title)s" --dateafter today-10days --playlist-start 1 --playlist-end 100 --ignore-errors --no-warnings https://www.youtube.com/playlist?list=PLbZIPy20-1pN7mqjckepWF78ndb6ci_qi
True

Seems to work
Good job mate, thank you!

@fe80Grau
Copy link
Owner

fe80Grau commented Apr 15, 2023

Perfect!! I am very happy that it works 😄
** Your description output is blank, this is another problem maybe. Is not critical because the script may end up with no description in the tvshow.nfo file. However, I pushed a new commit in main.
*the debug prints was cleared, only keeps description debug prints
*I edited the output of the temporary .description file.

Try it if you want and tell me if description is working.

If you do that and the description is still blank, run the following command and paste the output here please.
yt-dlp https://www.youtube.com/channel/UC8679JjreNLfSCgA-2Fb4kA --write-description --playlist-items 0 --output "/media/Youtube/SpineCard.description"

@CrazyWolf13
Copy link
Author

Perfect!! I am very happy that it works 😄
** Your description output is blank, this is another problem maybe. Is not critical because the script may end up with no description in the tvshow.nfo file. However, I pushed a new commit in main.
*the debug prints was cleared, only keeps description debug prints
*I edited the output of the temporary .description file.

Try it if you want and tell me if description is working.

If you do that and the description is still blank, run the following command and paste the output here please.
yt-dlp https://www.youtube.com/channel/UC8679JjreNLfSCgA-2Fb4kA --write-description --playlist-items 0 --output "/media/Youtube/SpineCard.description"

After downloading the new cli.py it seems to be broken, but maybe i have formated the channel list wrong?

Error:
cd /opt/ytdlp2STRM && /usr/bin/python3 /opt/ytdlp2STRM/cli.py --m make_files_strm --p youtube,stream
Traceback (most recent call last):
File "/opt/ytdlp2STRM/cli.py", line 12, in
config = json.load(f)
File "/usr/lib/python3.9/json/init.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 7 column 34 (char 260

Channel_list:

[
"list-PLCvX74b4S-Gt1QuPKHv1fqchVhIcSvHF2"
]

Is there something wrong with it?

@CrazyWolf13
Copy link
Author

CrazyWolf13 commented Apr 15, 2023

Here is the mentioned yt-dlp output:

yt-dlp https://www.youtube.com/channel/UC8679JjreNLfSCgA-2Fb4kA --write-description --playlist-items 0 --output "/mnt/Seagate/Youtube-STRM/SpineCard.description":

yt-dlp https://www.youtube.com/channel/UC8679JjreNLfSCgA-2Fb4kA --write-description --playlist-items 0 --output "/media/Youtube/SpineCard.description"
[youtube:tab] Extracting URL: https://www.youtube.com/channel/UC8679JjreNLfSCgA-2Fb4kA
[youtube:tab] UC8679JjreNLfSCgA-2Fb4kA: Downloading webpage
[youtube:tab] Downloading all uploads of the channel. To download only the videos in a specific tab, pass the tab's URL
[youtube:tab] Downloading as multiple playlists, separated by tabs. To download as a single playlist instead, pass https://www.youtube.com/playlist?list=UU8679JjreNLfSCgA-2Fb4kA
[download] Downloading playlist: SpineCard
ERROR: unable to create directory [Errno 13] Permission denied: '/media/Youtube'

/Media/Youtube does not exist in the file manager, I tried with media/pi

yt-dlp https://www.youtube.com/channel/UC8679JjreNLfSCgA-2Fb4kA --write-description --playlist-items 0 --output "/media/pi/SpineCard.description"
[youtube:tab] Extracting URL: https://www.youtube.com/channel/UC8679JjreNLfSCgA-2Fb4kA
[youtube:tab] UC8679JjreNLfSCgA-2Fb4kA: Downloading webpage
[youtube:tab] Downloading all uploads of the channel. To download only the videos in a specific tab, pass the tab's URL
[youtube:tab] Downloading as multiple playlists, separated by tabs. To download as a single playlist instead, pass https://www.youtube.com/playlist?list=UU8679JjreNLfSCgA-2Fb4kA
[download] Downloading playlist: SpineCard
[info] Writing playlist description to: /media/pi/SpineCard.description
ERROR: Cannot write playlist description file /media/pi/SpineCard.description

Apologize for the confusion, I used a different folder. The command works.

yt-dlp https://www.youtube.com/channel/UC8679JjreNLfSCgA-2Fb4kA --write-description --playlist-items 0 --output "/mnt/Seagate/Youtube-STRM/SpineCard.description"
[youtube:tab] Extracting URL: https://www.youtube.com/channel/UC8679JjreNLfSCgA-2Fb4kA
[youtube:tab] UC8679JjreNLfSCgA-2Fb4kA: Downloading webpage
[youtube:tab] Downloading all uploads of the channel. To download only the videos in a specific tab, pass the tab's URL
[youtube:tab] Downloading as multiple playlists, separated by tabs. To download as a single playlist instead, pass https://www.youtube.com/playlist?list=UU8679JjreNLfSCgA-2Fb4kA
[download] Downloading playlist: SpineCard
[info] Writing playlist description to: /mnt/Seagate/Youtube-STRM/SpineCard.description
[youtube:tab] Playlist SpineCard: Downloading 0 items of 3
[download] Finished downloading playlist: SpineCard

SpineCard.description:
Me froto la FRESA.

@fe80Grau
Copy link
Owner

fe80Grau commented Apr 15, 2023

Perrfect, description should work now in cli.py. thank you very much for outputs.

And your channel list it's okay, i edited my list with yours (without indent too) and works. Is working if you declare more channels?
Charset error may be, are you saving file as utf8 encode?

@CrazyWolf13
Copy link
Author

Perrfect, description should work now in cli.py. thank you very much for outputs.

And your channel list it's okay, i edited my list with yours (without indent too) and works. Is working if you declare more channels? Charset error may be, are you saving file as utf8 encode?

I tested with the exact channels as in channel_list.example.json and i'm still getting the error.

Files is saved with nano, just normal ctrl-x+y

@fe80Grau
Copy link
Owner

fe80Grau commented Apr 15, 2023

Ahhh the problem is in config.json, line 7 check if a comma is missing.

image

@CrazyWolf13
Copy link
Author

Thank you very much ❤️ !

It was a missing quote :/

Everything seems to work fine now.

I will try out the sponsorblock in the next days, maybe even today.

@CrazyWolf13
Copy link
Author

Thank you very much ❤️ !

It was a missing quote :/

Everything seems to work fine now.

I will try out the sponsorblock in the next days, maybe even today.

Files are being generated but jellyfin can't play them, there is just the error the client is not compatible with the media and the server does not send a compatible media format.

jellyfin-log:
[2023-04-15 17:04:16.410 +02:00] [ERR] Error processing request. URL "GET" "/videos/915b0cd2-b44b-0c28-0e15-a478a2fc003b/live.m3u8". MediaBrowser.Common.FfmpegException: FFmpeg exited with code 1 at Jellyfin.Api.Helpers.TranscodingJobHelper.StartFfMpeg(StreamState state, String outputPath, String commandLineArguments, HttpRequest request, TranscodingJobType transcodingJobType, CancellationTokenSource cancellationTokenSource, String workingDirectory) at Jellyfin.Api.Controllers.DynamicHlsController.GetLiveHlsStream(Guid itemId, String container, Nullable1 static, String params, String tag, String deviceProfileId, String playSessionId, String segmentContainer, Nullable1 segmentLength, Nullable1 minSegments, String mediaSourceId, String deviceId, String audioCodec, Nullable1 enableAutoStreamCopy, Nullable1 allowVideoStreamCopy, Nullable1 allowAudioStreamCopy, Nullable1 breakOnNonKeyFrames, Nullable1 audioSampleRate, Nullable1 maxAudioBitDepth, Nullable1 audioBitRate, Nullable1 audioChannels, Nullable1 maxAudioChannels, String profile, String level, Nullable1 framerate, Nullable1 maxFramerate, Nullable1 copyTimestamps, Nullable1 startTimeTicks, Nullable1 width, Nullable1 height, Nullable1 videoBitRate, Nullable1 subtitleStreamIndex, Nullable1 subtitleMethod, Nullable1 maxRefFrames, Nullable1 maxVideoBitDepth, Nullable1 requireAvc, Nullable1 deInterlace, Nullable1 requireNonAnamorphic, Nullable1 transcodingMaxAudioChannels, Nullable1 cpuCoreLimit, String liveStreamId, Nullable1 enableMpegtsM2TsMode, String videoCodec, String subtitleCodec, String transcodeReasons, Nullable1 audioStreamIndex, Nullable1 videoStreamIndex, Nullable1 context, Dictionary2 streamOptions, Nullable1 maxWidth, Nullable1 maxHeight, Nullable1 enableSubtitlesInManifest) at lambda_method1254(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Jellyfin.Server.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Jellyfin.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context)
[2023-04-15 17:04:16.456 +02:00] [INF] "/usr/lib/jellyfin-ffmpeg/ffprobe" "-analyzeduration 200M -i "[http://127.0.0.1:5000/youtube/stream/pCflI9qLDX0](http://127.0.0.1:5000/youtube/stream/pCflI9qLDX0%5C)" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format"
[2023-04-15 17:04:16.668 +02:00] [ERR] Error in "ffprobe"
MediaBrowser.Common.FfmpegException: ffprobe failed - streams and format are both null.
at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken) at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.GetMediaInfoInternal(String inputPath, String primaryPath, MediaProtocol protocol, Boolean extractChapters, String probeSizeArgument, Boolean isAudio, Nullable1 videoType, Boolean forceEnableLogging, CancellationToken cancellationToken)
at MediaBrowser.Providers.MediaInfo.FFProbeVideoInfo.ProbeVideo[T](T item, MetadataRefreshOptions options, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.MetadataService2.RunCustomProvider(ICustomMetadataProvider1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken)
[2023-04-15 17:04:16.670 +02:00] [ERR] Error in "YoutubeMetadata"
System.IO.FileNotFoundException: Could not find file '/mnt/Seagate/Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g]/Custom colors for your custom controller! - New Elite Series 2 colors available now [pCflI9qLDX0].info.json'.
File name: '/mnt/Seagate/Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g]/Custom colors for your custom controller! - New Elite Series 2 colors available now [pCflI9qLDX0].info.json'
at Interop.CheckIo(Error error, String path, Boolean isDirectory, Func2 errorRewriter) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize) at System.IO.File.InternalReadAllText(String path, Encoding encoding) at System.IO.File.ReadAllText(String path) at Jellyfin.Plugin.YoutubeMetadata.Utils.ReadYTDLInfo(String fpath, CancellationToken cancellationToken) at Jellyfin.Plugin.YoutubeMetadata.Providers.AbstractYoutubeLocalProvider2.GetMetadata(ItemInfo info, IDirectoryService directoryService, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.MetadataService2.RefreshWithProviders(MetadataResult1 metadata, TIdType id, MetadataRefreshOptions options, ICollection1 providers, ItemImageProvider imageService, CancellationToken cancellationToken) [2023-04-15 17:04:16.688 +02:00] [ERR] Error in "YoutubeMetadata" System.IO.FileNotFoundException: youtube-dl not found on path! at NYoutubeDL.Services.PreparationService.SetupPrepare(YoutubeDLP ydl) at NYoutubeDL.Services.InfoService.GetDownloadInfoAsync(YoutubeDLP ydl, CancellationToken cancellationToken) at NYoutubeDL.Services.PreparationService.PrepareDownloadAsync(YoutubeDLP ydl, CancellationToken cancellationToken) at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDLP ydl, CancellationToken cancellationToken) at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDLP ydl, String url, CancellationToken cancellationToken) at NYoutubeDL.YoutubeDLP.DownloadAsync(String videoUrl) at Jellyfin.Plugin.YoutubeMetadata.Utils.YTDLMetadata(String id, IServerApplicationPaths appPaths, CancellationToken cancellationToken) at Jellyfin.Plugin.YoutubeMetadata.Providers.YTDLMusicProvider.GetAndCacheMetadata(String id, IServerApplicationPaths appPaths, CancellationToken cancellationToken) at Jellyfin.Plugin.YoutubeMetadata.Providers.AbstractYoutubeRemoteProvider3.GetMetadata(E info, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.MetadataService2.ExecuteRemoteProviders(MetadataResult1 temp, String logName, TIdType id, IEnumerable1 providers, CancellationToken cancellationToken) [2023-04-15 17:04:16.736 +02:00] [INF] User policy for "Pi_Jellyfin". EnablePlaybackRemuxing: True EnableVideoPlaybackTranscoding: True EnableAudioPlaybackTranscoding: True [2023-04-15 17:04:16.737 +02:00] [INF] StreamBuilder.BuildVideoItem( Profile="Anonymous Profile", Path="http://127.0.0.1:5000/youtube/stream/pCflI9qLDX0", AudioStreamIndex=null, SubtitleStreamIndex=null ) => ( PlayMethod=Transcode, TranscodeReason=ContainerNotSupported, VideoCodecNotSupported ) "media:/videos/915b0cd2-b44b-0c28-0e15-a478a2fc003b/master.m3u8?MediaSourceId=915b0cd2b44b0c280e15a478a2fc003b&VideoCodec=h264&AudioCodec=aac,mp3&VideoBitrate=139808000&AudioBitrate=192000&api_key=&TranscodingMaxAudioChannels=2&RequireAvc=false&Tag=4f7439825b2a9c1957fe906e5dbf53aa&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=True&h264-profile=high,main,baseline,constrainedbaseline,high10&h264-rangetype=SDR&h264-level=52&h264-deinterlace=true&TranscodeReasons=ContainerNotSupported,%20VideoCodecNotSupported" [2023-04-15 17:04:16.765 +02:00] [INF] Deleting partial stream file(s) "/var/lib/jellyfin/transcodes/1ae1aae8f14bc00d47ca26deb874724c.m3u8" [2023-04-15 17:04:16.821 +02:00] [INF] Current HLS implementation doesn't support non-keyframe breaks but one is requested, ignoring that request [2023-04-15 17:04:16.826 +02:00] [INF] "/usr/lib/jellyfin-ffmpeg/ffmpeg" "-analyzeduration 200M -autorotate 0 -i "http://127.0.0.1:5000/youtube/stream/pCflI9qLDX0" -map_metadata -1 -map_chapters -1 -threads 0 -sn -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 0 -hls_base_url "hls/fa596c03141ca94a4c7017c18c0d1f2f/" -hls_segment_filename "/var/lib/jellyfin/transcodes/fa596c03141ca94a4c7017c18c0d1f2f%d.ts" -hls_playlist_type event -hls_list_size 0 -y "/var/lib/jellyfin/transcodes/fa596c03141ca94a4c7017c18c0d1f2f.m3u8"" [2023-04-15 17:04:17.014 +02:00] [ERR] FFmpeg exited with code 1 [2023-04-15 17:04:17.101 +02:00] [ERR] Error processing request. URL "GET" "/videos/915b0cd2-b44b-0c28-0e15-a478a2fc003b/live.m3u8". MediaBrowser.Common.FfmpegException: FFmpeg exited with code 1 at Jellyfin.Api.Helpers.TranscodingJobHelper.StartFfMpeg(StreamState state, String outputPath, String commandLineArguments, HttpRequest request, TranscodingJobType transcodingJobType, CancellationTokenSource cancellationTokenSource, String workingDirectory) at Jellyfin.Api.Controllers.DynamicHlsController.GetLiveHlsStream(Guid itemId, String container, Nullable1 static, String params, String tag, String deviceProfileId, String playSessionId, String segmentContainer, Nullable1 segmentLength, Nullable1 minSegments, String mediaSourceId, String deviceId, String audioCodec, Nullable1 enableAutoStreamCopy, Nullable1 allowVideoStreamCopy, Nullable1 allowAudioStreamCopy, Nullable1 breakOnNonKeyFrames, Nullable1 audioSampleRate, Nullable1 maxAudioBitDepth, Nullable1 audioBitRate, Nullable1 audioChannels, Nullable1 maxAudioChannels, String profile, String level, Nullable1 framerate, Nullable1 maxFramerate, Nullable1 copyTimestamps, Nullable1 startTimeTicks, Nullable1 width, Nullable1 height, Nullable1 videoBitRate, Nullable1 subtitleStreamIndex, Nullable1 subtitleMethod, Nullable1 maxRefFrames, Nullable1 maxVideoBitDepth, Nullable1 requireAvc, Nullable1 deInterlace, Nullable1 requireNonAnamorphic, Nullable1 transcodingMaxAudioChannels, Nullable1 cpuCoreLimit, String liveStreamId, Nullable1 enableMpegtsM2TsMode, String videoCodec, String subtitleCodec, String transcodeReasons, Nullable1 audioStreamIndex, Nullable1 videoStreamIndex, Nullable1 context, Dictionary2 streamOptions, Nullable1 maxWidth, Nullable1 maxHeight, Nullable1 enableSubtitlesInManifest) at lambda_method1254(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Jellyfin.Server.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Jellyfin.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context)
[2023-04-15 17:04:17.157 +02:00] [INF] Deleting partial stream file(s) "/var/lib/jellyfin/transcodes/fa596c03141ca94a4c7017c18c0d1f2f.m3u8"
[2023-04-15 17:04:18.660 +02:00] [INF] Playback stopped reported by app "Jellyfin Web" "10.8.9" playing "Custom colors for your custom controller! - New Elite Series 2 colors available now [pCflI9qLDX0]". Stopped at "0" ms
[2023-04-15 17:04:18.693 +02:00] [INF] Playback stop tracker found, processing stop : "TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzExMC4wLjAuMCBTYWZhcmkvNTM3LjM2IE9QUi85Ni4wLjAuMHwxNjc5NjAwOTc4Njg5-4d20fdb2ee484e7faf7ac453e424cd96-915b0cd2b44b0c280e15a478a2fc003b"
[2023-04-15 17:04:18.693 +02:00] [WRN] Slow HTTP Response from "http://192.168.1.111:8096/Sessions/Playing/Stopped" to "192.168.1.116" in 0:00:01.5442953 with Status Code 204
[2023-04-15 17:04:18.694 +02:00] [INF] PlaybackTracker : Adding Stop Event : 04/15/2023 17:04:18
[2023-04-15 17:04:18.694 +02:00] [INF] Playback stop but TrackedPlaybackInfo not found! not storing activity in DB
[2023-04-15 17:04:35.652 +02:00] [INF] session.RemoteEndPoint : "192.168.1.116"
[2023-04-15 17:04:35.654 +02:00] [INF] StartPlaybackTimer : event_playing_id = "915b0cd2b44b0c280e15a478a2fc003b"
[2023-04-15 17:04:35.655 +02:00] [INF] StartPlaybackTimer : event_user_id = "4d20fdb2ee484e7faf7ac453e424cd96"
[2023-04-15 17:04:35.656 +02:00] [INF] StartPlaybackTimer : event_user_id_int = 1
[2023-04-15 17:04:35.657 +02:00] [INF] StartPlaybackTimer : session_playing_id = ""
[2023-04-15 17:04:35.658 +02:00] [INF] StartPlaybackTimer : session_user_id = "4d20fdb2ee484e7faf7ac453e424cd96"
[2023-04-15 17:04:35.659 +02:00] [INF] StartPlaybackTimer : play_method = "na"
[2023-04-15 17:04:35.660 +02:00] [INF] StartPlaybackTimer : e.ClientName = "Jellyfin Web"
[2023-04-15 17:04:35.660 +02:00] [INF] StartPlaybackTimer : e.DeviceName = "Opera"
[2023-04-15 17:04:35.660 +02:00] [INF] StartPlaybackTimer : ItemName = "Custom colors for your custom controller! - New Elite Series 2 colors available now [pCflI9qLDX0]"
[2023-04-15 17:04:35.660 +02:00] [INF] StartPlaybackTimer : ItemId = "915b0cd2b44b0c280e15a478a2fc003b"
[2023-04-15 17:04:35.660 +02:00] [INF] StartPlaybackTimer : ItemType = "MusicVideo"
[2023-04-15 17:04:35.661 +02:00] [INF] StartPlaybackTimer : Details do not match for play item
[2023-04-15 17:04:35.661 +02:00] [INF] StartPlaybackTimer : Exited
`

And a bunch more.

@fe80Grau
Copy link
Owner

Check if service is running
systemctl status ytdlp2strm.service

@CrazyWolf13
Copy link
Author

● ytdlp2strm.service - ytdlp2STRM Service
Loaded: loaded (/etc/systemd/system/ytdlp2strm.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-04-15 16:54:04 CEST; 23min ago
Main PID: 549 (python3)
Tasks: 2 (limit: 1167)
CPU: 2.352s
CGroup: /system.slice/ytdlp2strm.service
└─549 /usr/bin/python3 /opt/ytdlp2STRM/main.py

Apr 15 17:04:17 raspberrypi python3[549]: for item in iterable:
Apr 15 17:04:17 raspberrypi python3[549]: File "/usr/lib/python3/dist-packages/flask/helpers.py", line 162, in g>
Apr 15 17:04:17 raspberrypi python3[549]: for item in gen:
Apr 15 17:04:17 raspberrypi python3[549]: File "/opt/ytdlp2STRM/main.py", line 54, in generate
Apr 15 17:04:17 raspberrypi python3[549]: process = subprocess.Popen(ytdlp_command, stdout=subprocess.PIPE)
Apr 15 17:04:17 raspberrypi python3[549]: File "/usr/lib/python3.9/subprocess.py", line 951, in init
Apr 15 17:04:17 raspberrypi python3[549]: self._execute_child(args, executable, preexec_fn, close_fds,
Apr 15 17:04:17 raspberrypi python3[549]: File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child
Apr 15 17:04:17 raspberrypi python3[549]: raise child_exception_type(errno_num, err_msg, err_filename)
Apr 15 17:04:17 raspberrypi python3[549]: FileNotFoundError: [Errno 2] No such file or directory: 'yt-dlp'

Check if service is running systemctl status ytdlp2strm.service

@fe80Grau
Copy link
Owner

install yt-dlp as root and restart service
systemctl restart ytdlp2strm.service
and check again
systemctl status ytdlp2strm.service

@CrazyWolf13
Copy link
Author

● ytdlp2strm.service - ytdlp2STRM Service
Loaded: loaded (/etc/systemd/system/ytdlp2strm.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-04-15 17:26:41 CEST; 13s ago
Main PID: 3181 (python3)
Tasks: 2 (limit: 1167)
CPU: 810ms
CGroup: /system.slice/ytdlp2strm.service
└─3181 /usr/bin/python3 /opt/ytdlp2STRM/main.py

Apr 15 17:26:41 raspberrypi systemd[1]: Started ytdlp2STRM Service.
Apr 15 17:26:42 raspberrypi python3[3181]: * Serving Flask app "main" (lazy loading)
Apr 15 17:26:42 raspberrypi python3[3181]: * Environment: production
Apr 15 17:26:42 raspberrypi python3[3181]: WARNING: This is a development server. Do not use it in a production>
Apr 15 17:26:42 raspberrypi python3[3181]: Use a production WSGI server instead.
Apr 15 17:26:42 raspberrypi python3[3181]: * Debug mode: off
Apr 15 17:26:42 raspberrypi python3[3181]: * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

Seems a lot better to me.

Should this service start automatically? or why did that happen?

@CrazyWolf13
Copy link
Author

CrazyWolf13 commented Apr 15, 2023

Jellyfin just loads forever :/ and never starts playing the video.

at lambda_method1060(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager) at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager) at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager) at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager) at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Jellyfin.Server.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Jellyfin.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext) at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context) at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager) at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context) [2023-04-15 17:38:46.021 +02:00] [WRN] Slow HTTP Response from "http://192.168.1.111:8096/Items/8a8e814050e6054a45184c4554e4d98a/PlaybackInfo?UserId=4d20fdb2ee484e7faf7ac453e424cd96&StartTimeTicks=0&IsPlayback=true&AutoOpenLiveStream=true&MaxStreamingBitrate=140000000" to "192.168.1.116" in 0:00:13.0081143 with Status Code 500 [2023-04-15 17:38:56.642 +02:00] [ERR] Error in "YoutubeMetadata" System.IO.FileNotFoundException: Could not find file '/mnt/Seagate/Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g]/Battlefield 2042 Season 4 Leviathan Rising Event Trailer [xHSufRxcYtM].info.json'. File name: '/mnt/Seagate/Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g]/Battlefield 2042 Season 4 Leviathan Rising Event Trailer [xHSufRxcYtM].info.json' at Interop.CheckIo(Error error, String path, Boolean isDirectory, Func2 errorRewriter)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
at System.IO.File.InternalReadAllText(String path, Encoding encoding)
at System.IO.File.ReadAllText(String path)
at Jellyfin.Plugin.YoutubeMetadata.Utils.ReadYTDLInfo(String fpath, CancellationToken cancellationToken)
at Jellyfin.Plugin.YoutubeMetadata.Providers.AbstractYoutubeLocalProvider2.GetMetadata(ItemInfo info, IDirectoryService directoryService, CancellationToken cancellationToken) at MediaBrowser.Providers.Manager.MetadataService2.RefreshWithProviders(MetadataResult1 metadata, TIdType id, MetadataRefreshOptions options, ICollection1 providers, ItemImageProvider imageService, CancellationToken cancellationToken)

@fe80Grau
Copy link
Owner

after play a video check service status. If is an flask or stream error should show with systemctl status ytdl2strm.service

If you are in local try to play a video in VLC (file -> open network medio or something like this), get an strm file content (you will see an URL like http://127.0.0.1:5000/youtube/download/689h31Np29E, change 127.0.0.1 by ytdlp2strm local IP)

**I detect a problem with stream mode and "short", for example

http://127.0.0.1:5000/youtube/stream/pCflI9qLDX0 <- is not working
http://127.0.0.1:5000/youtube/download/pCflI9qLDX0 <- is working

i will work to fix this. You can use download mode (disk usage is temporaly)

@CrazyWolf13
Copy link
Author

Status log after restarting and then starting to play the video on jellyfin, there is just a circle turning infinitely.

sudo systemctl status ytdlp2strm.service
● ytdlp2strm.service - ytdlp2STRM Service
Loaded: loaded (/etc/systemd/system/ytdlp2strm.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-04-15 17:55:51 CEST; 28s ago
Main PID: 4112 (python3)
Tasks: 4 (limit: 1167)
CPU: 8.609s
CGroup: /system.slice/ytdlp2strm.service
├─4112 /usr/bin/python3 /opt/ytdlp2STRM/main.py
└─4130 /usr/bin/python3 /usr/local/bin/yt-dlp -o - -f bv*+ba+ba.2 --audio-multistreams 377lsCtAAAU

Apr 15 17:55:51 raspberrypi systemd[1]: Started ytdlp2STRM Service.
Apr 15 17:55:52 raspberrypi python3[4112]: * Serving Flask app "main" (lazy loading)
Apr 15 17:55:52 raspberrypi python3[4112]: * Environment: production
Apr 15 17:55:52 raspberrypi python3[4112]: WARNING: This is a development server. Do not use it in a production>
Apr 15 17:55:52 raspberrypi python3[4112]: Use a production WSGI server instead.
Apr 15 17:55:52 raspberrypi python3[4112]: * Debug mode: off
Apr 15 17:55:52 raspberrypi python3[4112]: * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
Apr 15 17:56:14 raspberrypi python3[4130]: [youtube] Extracting URL: 377lsCtAAAU
Apr 15 17:56:14 raspberrypi python3[4130]: [youtube] 377lsCtAAAU: Downloading webpage
Apr 15 17:56:15 raspberrypi python3[4130]: [youtube] 377lsCtAAAU: Downloading android player API JSON

pi@raspberrypi:~ $ sudo systemctl status ytdlp2strm.service
● ytdlp2strm.service - ytdlp2STRM Service
Loaded: loaded (/etc/systemd/system/ytdlp2strm.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-04-15 17:55:51 CEST; 35s ago
Main PID: 4112 (python3)
Tasks: 7 (limit: 1167)
CPU: 12.063s
CGroup: /system.slice/ytdlp2strm.service
├─4112 /usr/bin/python3 /opt/ytdlp2STRM/main.py
└─4168 ffmpeg -y -hide_banner -headers User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWeb>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\x0d
Accept-Language: en-us,en;q=0.5\x0d
Sec-Fetch-Mode: navigate\x0d
-i https://rr5---sn-nfpnnjvh-1gir.googlevideo.com/videoplayback?expire=1681595775&ei=H8k6ZJ3vB4W2-gagz42gAQ&ip=2a>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\x0d
Accept-Language: en-us,en;q=0.5\x0d
Sec-Fetch-Mode: navigate\x0d
-i https://rr5---sn-nfpnnjvh-1gir.googlevideo.com/videoplayback?expire=1681595775&ei=H8k6ZJ3vB4W2-gagz42gAQ&ip=2a>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\x0d
Accept-Language: en-us,en;q=0.5\x0d
Sec-Fetch-Mode: navigate\x0d
-i https://rr5---sn-nfpnnjvh-1gir.googlevideo.com/videoplayback?expire=1681595775&ei=H8k6ZJ3vB4W2-gagz42gAQ&ip=2a>

Apr 15 17:56:24 raspberrypi python3[4168]: Stream #0:2(eng): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 >
Apr 15 17:56:24 raspberrypi python3[4168]: Metadata:
Apr 15 17:56:24 raspberrypi python3[4168]: creation_time : 2023-04-06T08:43:19.000000Z
Apr 15 17:56:24 raspberrypi python3[4168]: handler_name : ISO Media file produced by Google Inc.
Apr 15 17:56:24 raspberrypi python3[4168]: Stream mapping:
Apr 15 17:56:24 raspberrypi python3[4168]: Stream #0:0 -> #0:0 (copy)
Apr 15 17:56:24 raspberrypi python3[4168]: Stream #1:0 -> #0:1 (copy)
Apr 15 17:56:24 raspberrypi python3[4168]: Stream #2:0 -> #0:2 (copy)
Apr 15 17:56:24 raspberrypi python3[4168]: Press [q] to stop, [?] for help
Apr 15 17:56:24 raspberrypi python3[4112]: 127.0.0.1 - - [15/Apr/2023 17:56:24] "GET /youtube/stream/377lsCtAAAU H>
ESCOC
.py
Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari>
=0.9,/;q=0.8\x0d

layback?expire=1681595775&ei=H8k6ZJ3vB4W2-gagz42gAQ&ip=2a02%3A1210%3A2a42%3Aeb00%3Afd64%3Aff56%3A20b6%3A5d1f&id=o->
=0.9,/;q=0.8\x0d

layback?expire=1681595775&ei=H8k6ZJ3vB4W2-gagz42gAQ&ip=2a02%3A1210%3A2a42%3Aeb00%3Afd64%3Aff56%3A20b6%3A5d1f&id=o->
=0.9,/;q=0.8\x0d

layback?expire=1681595775&ei=H8k6ZJ3vB4W2-gagz42gAQ&ip=2a02%3A1210%3A2a42%3Aeb00%3Afd64%3Aff56%3A20b6%3A5d1f&id=o->

2(eng): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, fltp, 10 kb/s (default)

_time : 2023-04-06T08:43:19.000000Z
name : ISO Media file produced by Google Inc.
:
-> #0:0 (copy)
-> #0:1 (copy)
-> #0:2 (copy)
top, [?] for help
[15/Apr/2023 17:56:24] "GET /youtube/stream/377lsCtAAAU HTTP/1.1" 200 -
ESCOD
CPU: 12.063s
CGroup: /system.slice/ytdlp2strm.service
CPU: 12.063s
CGroup: /system.slice/ytdlp2strm.service
● ytdlp2strm.service - ytdlp2STRM Service
Loaded: loaded (/etc/systemd/system/ytdlp2strm.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-04-15 17:55:51 CEST; 35s ago
Main PID: 4112 (python3)
Tasks: 7 (limit: 1167)
CPU: 12.063s
CGroup: /system.slice/ytdlp2strm.service
├─4112 /usr/bin/python3 /opt/ytdlp2STRM/main.py
└─4168 ffmpeg -y -hide_banner -headers User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWeb>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\x0d
Accept-Language: en-us,en;q=0.5\x0d
Sec-Fetch-Mode: navigate\x0d
-i https://rr5---sn-nfpnnjvh-1gir.googlevideo.com/videoplayback?expire=1681595775&ei=H8k6ZJ3vB4W2-gagz42gAQ&ip=2a>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\x0d
Accept-Language: en-us,en;q=0.5\x0d
Sec-Fetch-Mode: navigate\x0d
-i https://rr5---sn-nfpnnjvh-1gir.googlevideo.com/videoplayback?expire=1681595775&ei=H8k6ZJ3vB4W2-gagz42gAQ&ip=2a>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8\x0d
Accept-Language: en-us,en;q=0.5\x0d
Sec-Fetch-Mode: navigate\x0d
-i https://rr5---sn-nfpnnjvh-1gir.googlevideo.com/videoplayback?expire=1681595775&ei=H8k6ZJ3vB4W2-gagz42gAQ&ip=2a>

Apr 15 17:56:24 raspberrypi python3[4168]: Stream #0:2(eng): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 >
Apr 15 17:56:24 raspberrypi python3[4168]: Metadata:
Apr 15 17:56:24 raspberrypi python3[4168]: creation_time : 2023-04-06T08:43:19.000000Z
Apr 15 17:56:24 raspberrypi python3[4168]: handler_name : ISO Media file produced by Google Inc.
Apr 15 17:56:24 raspberrypi python3[4168]: Stream mapping:
Apr 15 17:56:24 raspberrypi python3[4168]: Stream #0:0 -> #0:0 (copy)
Apr 15 17:56:24 raspberrypi python3[4168]: Stream #1:0 -> #0:1 (copy)
Apr 15 17:56:24 raspberrypi python3[4168]: Stream #2:0 -> #0:2 (copy)
Apr 15 17:56:24 raspberrypi python3[4168]: Press [q] to stop, [?] for help
Apr 15 17:56:24 raspberrypi python3[4112]: 127.0.0.1 - - [15/Apr/2023 17:56:24] "GET /youtube/stream/377lsCtAAAU H>
lines 8-32/32 (END)

http://127.0.0.1:5000/youtube/stream/pCflI9qLDX0
http://127.0.0.1:5000/youtube/download/pCflI9qLDX0

Both of them work, the stream one starts faster.

@CrazyWolf13
Copy link
Author

This is the jellyfin log:

[2023-04-15 17:39:32.056 +02:00] [WRN] Slow HTTP Response from "http://192.168.1.111:8096/Items/dbd78304db264716eaaceabef354a274/PlaybackInfo?UserId=4d20fdb2ee484e7faf7ac453e424cd96&StartTimeTicks=0&IsPlayback=true&AutoOpenLiveStream=true&MaxStreamingBitrate=140000000" to "192.168.1.116" in 0:00:54.5889167 with Status Code 500
[2023-04-15 17:45:30.504 +02:00] [INF] Sending ForceKeepAlive message to 1 inactive WebSockets.
[2023-04-15 17:45:42.506 +02:00] [INF] Lost 1 WebSockets.
[2023-04-15 17:56:11.685 +02:00] [INF] "/usr/lib/jellyfin-ffmpeg/ffprobe" "-analyzeduration 200M -i "http://127.0.0.1:5000/youtube/stream/377lsCtAAAU\" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format"
[2023-04-15 17:56:24.587 +02:00] [ERR] Error in "YoutubeMetadata"
System.IO.FileNotFoundException: Could not find file '/mnt/Seagate/Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g]/4 Years and Counting! Uncover the Surprises of the Latest Update in World of Warships Legends [377lsCtAAAU].info.json'.
File name: '/mnt/Seagate/Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g]/4 Years and Counting! Uncover the Surprises of the Latest Update in World of Warships Legends [377lsCtAAAU].info.json'
at Interop.CheckIo(Error error, String path, Boolean isDirectory, Func2 errorRewriter) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize) at System.IO.File.InternalReadAllText(String path, Encoding encoding) at System.IO.File.ReadAllText(String path) at Jellyfin.Plugin.YoutubeMetadata.Utils.ReadYTDLInfo(String fpath, CancellationToken cancellationToken) at Jellyfin.Plugin.YoutubeMetadata.Providers.AbstractYoutubeLocalProvider2.GetMetadata(ItemInfo info, IDirectoryService directoryService, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.MetadataService2.RefreshWithProviders(MetadataResult1 metadata, TIdType id, MetadataRefreshOptions options, ICollection1 providers, ItemImageProvider imageService, CancellationToken cancellationToken) [2023-04-15 17:56:24.728 +02:00] [ERR] Error processing request. URL "POST" "/Items/8a8e814050e6054a45184c4554e4d98a/PlaybackInfo". Constraint: SQLitePCL.pretty.SQLiteException: NOT NULL constraint failed: ItemValues.Type at SQLitePCL.pretty.SQLiteException.Throw(Int32 rc, Int32 extended, String msg) at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc) at SQLitePCL.pretty.StatementImpl.MoveNext() at Emby.Server.Implementations.Data.SqliteItemRepository.InsertItemValues(Byte[] idBlob, List1 values, IDatabaseConnection db)
at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemValues(Guid itemId, List1 values, IDatabaseConnection db) at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTransaction(IDatabaseConnection db, IEnumerable1 tuples)
at Emby.Server.Implementations.Data.SqliteItemRepository.<>c__DisplayClass34_0.b__0(IDatabaseConnection db)
at SQLitePCL.pretty.DatabaseConnection.<>c__DisplayClass20_0.b__0(IDatabaseConnection db)
at SQLitePCL.pretty.DatabaseConnection.RunInTransaction[T](IDatabaseConnection This, Func2 f, TransactionMode mode) at SQLitePCL.pretty.DatabaseConnection.RunInTransaction(IDatabaseConnection This, Action1 action, TransactionMode mode)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(IEnumerable1 items, CancellationToken cancellationToken) at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Video.UpdateToRepositoryAsync(ItemUpdateType updateReason, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.MetadataService2.SaveItemAsync(MetadataResult1 result, ItemUpdateType reason, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.MetadataService2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken) at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken) at Emby.Server.Implementations.Library.MediaSourceManager.GetPlaybackMediaSources(BaseItem item, User user, Boolean allowMediaProbe, Boolean enablePathSubstitution, CancellationToken cancellationToken) at Jellyfin.Api.Helpers.MediaInfoHelper.GetPlaybackInfo(Guid id, Nullable1 userId, String mediaSourceId, String liveStreamId)
at Jellyfin.Api.Controllers.MediaInfoController.GetPostedPlaybackInfo(Guid itemId, Nullable1 userId, Nullable1 maxStreamingBitrate, Nullable1 startTimeTicks, Nullable1 audioStreamIndex, Nullable1 subtitleStreamIndex, Nullable1 maxAudioChannels, String mediaSourceId, String liveStreamId, Nullable1 autoOpenLiveStream, Nullable1 enableDirectPlay, Nullable1 enableDirectStream, Nullable1 enableTranscoding, Nullable1 allowVideoStreamCopy, Nullable1 allowAudioStreamCopy, PlaybackInfoDto playbackInfoDto)
at lambda_method1060(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Jellyfin.Server.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Jellyfin.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context)
[2023-04-15 17:56:24.910 +02:00] [WRN] Slow HTTP Response from "http://192.168.1.111:8096/Items/8a8e814050e6054a45184c4554e4d98a/PlaybackInfo?UserId=4d20fdb2ee484e7faf7ac453e424cd96&StartTimeTicks=0&IsPlayback=true&AutoOpenLiveStream=true&MaxStreamingBitrate=140000000" to "192.168.1.116" in 0:00:13.1612337 with Status Code 500

@CrazyWolf13
Copy link
Author

Sorry for just spamming my logs 😢

@fe80Grau
Copy link
Owner

yepp don't worry, we will get it.
In Jellyfin control panel, go to encoding settings and disable last option
image

Sorry i have Jellyfin in spanish. If you have troubles tell me and i try to help you

@CrazyWolf13
Copy link
Author

yepp don't worry, we will get it.
In Jellyfin control panel, go to encoding settings and disable last option
image

Sorry i have Jellyfin in spanish. If you have troubles tell me and i try to help you

Thank you!

I did that, but it does not seem to work, there is still the blue circle turning around.

Is that problem related to the youtube metadata plugin, jellyfin or ytdlp2strm?
I'd suggest jellyfin, because it works in the browser?

@fe80Grau
Copy link
Owner

fe80Grau commented Apr 15, 2023

The last error says:

[2023-04-15 17:56:11.685 +02:00] [INF] "/usr/lib/jellyfin-ffmpeg/ffprobe" "-analyzeduration 200M -i "http://127.0.0.1:5000/youtube/stream/377lsCtAAAU\" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format"

[2023-04-15 17:56:24.587 +02:00] [ERR] Error in "YoutubeMetadata"

System.IO.FileNotFoundException: Could not find file '/mnt/Seagate/Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g]/4 Years and Counting! Uncover the Surprises of the Latest Update in World of Warships Legends [377lsCtAAAU].info.json'.

YoutubeMetada try to make .info.json for each Youtube video (in our case each strm file) . Try disabling YoutubeMetada plugin, fully restart your server (i would say a complete reboot) and try again.
And the las backslash in url in ffprobe is not normal, i try to reproduce your sceneario in my house.

@CrazyWolf13
Copy link
Author

The last error says:

[2023-04-15 17:56:11.685 +02:00] [INF] "/usr/lib/jellyfin-ffmpeg/ffprobe" "-analyzeduration 200M -i "[http://127.0.0.1:5000/youtube/stream/377lsCtAAAU](http://127.0.0.1:5000/youtube/stream/377lsCtAAAU%5C)" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format"

[2023-04-15 17:56:24.587 +02:00] [ERR] Error in "YoutubeMetadata"

System.IO.FileNotFoundException: Could not find file '/mnt/Seagate/Youtube-STRM/@xbox [UCjBp_7RuDBUYbd1LegWEJ8g]/4 Years and Counting! Uncover the Surprises of the Latest Update in World of Warships Legends [377lsCtAAAU].info.json'.

YoutubeMetada try to make .info.json for each Youtube video (in our case each strm file) . Try disabling YoutubeMetada plugin, fully restart your server (i would say a complete reboot) and try again. And the las backslash in url in ffprobe is not normal, i try to reproduce your sceneario in my house.

YoutubeMetadata has now been turned off after some trouble.

Now the blue circle turns and then there is just a black screen. :/

@CrazyWolf13
Copy link
Author

I think i'll ask in the jellyfin help matrix chats, don't really want to bother you with this issue^^.

@fe80Grau
Copy link
Owner

Okey mate, i keep open this issue. if you found a solution and remember this post please share it 😄

@CrazyWolf13
Copy link
Author

Okey mate, i keep open this issue. if you found a solution and remember this post please share it 😄

Hey, yeah they could actually help me, the strm live stream mode i chose was too much for the raspberrypi, I thought it would simply pass the link to the client not that the pi has to download it in real time and server it to the client at the same time (0.2x speed did it manage to get lol)

So I think choosing the download command should fix this issue, one moment i will test it.

@fe80Grau fe80Grau changed the title sanitize Filename error sanitize Filename error and problems with Jellyfin and strm files on Raspberry Pi3b+ Apr 15, 2023
@fe80Grau fe80Grau changed the title sanitize Filename error and problems with Jellyfin and strm files on Raspberry Pi3b+ problems with Jellyfin and strm files on Raspberry Pi3b+ Apr 15, 2023
@fe80Grau fe80Grau changed the title problems with Jellyfin and strm files on Raspberry Pi3b+ issue with Jellyfin and strm files on Raspberry Pi3b+ Apr 15, 2023
@CrazyWolf13
Copy link
Author

CrazyWolf13 commented Apr 15, 2023

I think for the moment i will use regular yt-dlp to download the files and import them to jellyfin, that seems the easiest with my raspberrypi.

I'm really sorry, to tell this, but maybe in the future when i have more knowledge about android i could try to write some sort of android app around this to allow the user to choose a video from a simple youtube ui, then ytdlp2strm takes those and routes them either via strm or via video/audio file to jellyfin and syncs the library.

@fe80Grau
Copy link
Owner

fe80Grau commented Apr 15, 2023

Very good idea, I added a new mode besides stream and download. I called it "redirect" and it does exactly that you say, a 301 redirect to the temporary youtube URL of the video/audio mixed. Luckily yt-dlp manages this. With redirect mode the load is fast, no cpu is used and no disk is used.

I added it in the README, but you can make the simple change in the cron job file and edit the download or stream parameter to redirect

Sponsorblock not works in redirect mode

@CrazyWolf13
Copy link
Author

Very good idea, I added a new mode besides stream and download. I called it "redirect" and it does exactly that you say, a 301 redirect to the temporary youtube URL of the video/audio mixed. Luckily yt-dlp manages this. With redirect mode the load is fast, no cpu is used and no disk is used.

I added it in the README, but you can make the simple change in the cron job file and edit the download or stream parameter to redirect

Sponsorblock not works in redirect mode
Wow, great job.

Well, doesn't my pi still has to download the video and stream it to the client?

@fe80Grau
Copy link
Owner

fe80Grau commented Apr 15, 2023

stream mode gets video data from yt-dlp and pass throught http directly, don't wait complete video download, this process is managed by yt-dlp.

download mode first download full video in temp file and then the file is served like a normal file throught http server

with redirect mode your pi doesn't download video and doesn't stream video data, this mode only redirect and amazingly it is working 😄

@CrazyWolf13
Copy link
Author

Ohh really, I though I dreamed when I read this lol.

Command is currently running and I'm waiting to see the results:)

@CrazyWolf13
Copy link
Author

It actually works, I'm very surprised!
Even tough it brings my pi to his limits but he is able to manage it, with like 2 minutes of loading time lmao.

Thank you soo much for doing this and helping me all day long, this really made my day. ❤️

If you ever need a helping hand here or help with testing feel free to mention me at any time.

@fe80Grau
Copy link
Owner

fe80Grau commented Apr 16, 2023

Yeahh!! I told you we'd get it and we got it.
It's unusual that I'm pending all day, but today I just had no plans and I was comfortable working on this while enjoying the calm of not having any obligation or commitment. so i've had fun 😃

Anyway, thank you very much also for your patience with the trial / error . Any other comment, idea, suggestion, bug (I hope it's not that) or anything is welcome.

Finally I can consider this issue resolved

@fe80Grau
Copy link
Owner

fe80Grau commented Apr 16, 2023

@CrazyWolf13 , if you want more power than your Raspberry, you can get "always free instance" in Oracle
Here a guide -> https://foundryvtt.wiki/en/setup/hosting/always-free-oracle

Register a user with your country, but when you are in the "country choice" for server, select France (Marselle), Spain (Madrid) or search in reddit a country with ARM instances available (in a lot of countrys are all bussy). You can deploy for always free an ARM instance with 4 vCPU, 24GB RAM and 200GB disk space, if you have pcloud, gdrive, onedrive you can use rclone to work with no space restrictions !!! I'm one of this and works very well with Jellyfin and 4K video and IPTV.

@CrazyWolf13
Copy link
Author

Thank you very much for this suggestion, but at the moment I prefer to only have my files locally, but I will keep this in mind.

@fe80Grau fe80Grau added bug Something isn't working enhancement New feature or request labels Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants