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

Quality-of-life fixes #7

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Quality-of-life fixes #7

wants to merge 5 commits into from

Conversation

medape
Copy link
Contributor

@medape medape commented Jul 28, 2024

Hello again! Thank you so much for accepting my last pull request. And for your appreciation.

You mentioned wanting to expand the script, maybe there is a way to make it so we can use the same code for a GUI, and for a CLI like CITGuru/PyInquirer? I don't know, it's a topic I never looked into a lot.

I'm planning to add a couple of CSV formats I'm going to make use for, but for now, I wanted to have you look if you're interested in these commits. Most of them are small tweaks and fixes.

The largest addition here is that now, if fed a .ZIP file, the extractor automatically checks if there is a newpipe.db file weighing less than 1 GiB (uncompressed), and if so, extracts it to a temporary folder so as to save the user that "effort". There is a way to extract the file directly to memory, but I couldn't find the way to run SQL queries on that.

medape added 5 commits July 14, 2024 00:38
And also replace inline code fences (three grave accents on each side)
with inline code spans (one grave accent on each side).
The .MD option was programmed to output the duration of each video, but this feature
assumed that all videos had a definite duration between 0 seconds and 59:59. This
fails for live streams, which report a duration of -1, so the MD exporter incorrectly
labelled this with (-1:59).

To counter this, .MD now labels live streams with the indication (LIVE) instead of
a time, and prints no indication if the video is not a live stream, but the duration
is a negative number. It also labels correctly videos over an hour, and labels
videos over one day as d:hh:mm:ss.

The MU8 format was not affected by this bug, as the duration must always be specified,
and -1 is the standard value for "not applicable".
If the argument of this script ends in .zip (case-insensitive), it automatically
extracts newpipe.db to a temporary directory, reads all necessary data from there,
and then deletes the whole temporary directory.

Instructions in the script have been updated to that effect.
Adding an explicit list to avoid a collision between streams.thumbnail_url and
playlists.thumbnail_url.

The downside to this method is that new values that NewPipe may add in the future
are not added automatically to the JSON dump.

Also corrected the description of the variable PlaylistDir at getPlaylists()
Adding a couple failsafes to the automatic ZIP extraction, and returning None, None
when create_connection() raises an exception, to handle errors more cleanly.
@medape medape changed the title Quality of life fixes Quality-of-life fixes Jul 28, 2024
@Quasolaris
Copy link
Owner

Hi @medape
Thank you so much for adding more features!

I'm a bit packed at the moment but I will take a look, test and merge it as soon as I got time.

@Quasolaris Quasolaris self-requested a review July 30, 2024 18:24
@Quasolaris Quasolaris self-assigned this Jul 30, 2024
@Quasolaris Quasolaris added the enhancement New feature or request label Jul 30, 2024
@Quasolaris
Copy link
Owner

Quasolaris commented Sep 8, 2024

Hi Medape

I finally had time to look at your pull request!
Again thank you for the additions, especially the ZIP-Extraction I wanted to do that for a long time but just never came around to do it.

Features/changes tested:

  • - .md Files fix for streams
  • - Typos fixed
  • [ ] - ZIP Autoextract (See Review Comments)
  • [ ] - SQL Query updates (See Review Comments)
  • - Added error handling
  • [ ] - Tested if everything still works (ZIP and SQL not working in this Pull Request)

I found two things that make the request not working on my end (see the review comments on the corresponding lines), the rest works as intended.

Regarding the GUI, thanks for the input, I'll take at look at CITGuru/PyInquirer.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants