[-] thingsiplay@beehaw.org 1 points 2 minutes ago

Besides that I don't like its installation is a curl into bash and then the script itself curls data from internet (from another repository https://github.com/HorlogeSkynet/thunderbird-user.js); not a good practice. But besides that point that get ignored anyway...

A tip: You can use in a single sed command multiple -e . So you would need to run sed only once and load the file only once (or only a few times). Like this: sed -e 's/abc/ABC/g' -e 's/def/DEF/g' file.ext and you can have each of them on their own line too:

sed \
-i
-e 's/abc/ABC/g' \
-e 's/def/DEF/g' \
user.js

Why do you have so many huge block of whitespaces, such as 10 empty lines in row, multiple times throughout the script? An why are there so many unused lines of code, commented out? I think you should delete them completely to not confuse people. If you want do additional features people can use optionally, then either create options for that or create another script that can be run if its installed (check if file exists and then run it if user installed it).

These are just a few thoughts I had when looking into the code.

[-] thingsiplay@beehaw.org 3 points 4 hours ago

Just tried and that's it! I tried a few options before, not sure if I overlooked this or misunderstood. But setting --extractor-retries 2 for testing does indeed only try 2 times. Thank you.

19
submitted 5 hours ago* (last edited 3 hours ago) by thingsiplay@beehaw.org to c/foss@beehaw.org

Solution: Thanks for finding the solution, kate (in the comments). The option to control this is --extractor-retries .


I recently start using SponsorBlock feature with yt-dlp . When it looks up SponsorBlock server, it tries 3 times to connect and download information. I would like to increase the retries for this specifically, but could not find the right setting or option in the manual (man yt-dlp) and help (yt-dlp --help). I would like to increase it to at least 5 or maybe even 10 retries per video.

I've noticed for sometimes it cannot login within the first 3 look ups, but when I retry the command after that it will just look up fine. Therefore an increase in the retries setting would be helpful. Especially helpful when downloading entire playlists, leaving it for some time alone.

[-] thingsiplay@beehaw.org 11 points 6 hours ago

It's a bit too early and premature. There needs to be an alternative to fax first.

[-] thingsiplay@beehaw.org 2 points 23 hours ago

No. All you need to do is put them in the right place. If they are marked as missing, either they are not in the correct folder, not named correctly or are the wrong versions.

Note: You don't need all files that are marked as missing in this list. There are bios files from PSP and PS3, but you don't need them. You only need the 3 original PS bios files, 1 for each region: scph5500.bin, scph5501.bin, scph5502.bin . Make sure they are the correct versions. Easiest way to check that is with md5sum . Then compare it to the MD5 listed at documentation link I gave you earlier, which looks like these 490f666e1afb15b7362b406ed1cea246 . Its enough to just compare the first few and last few characters to make sure its correct.

Without getting creepy (I have only good intentions) I looked up your post history to see if you were a Linux user. I can see you was setting up Batocera at some point. It is entirely possible that the system you are using setup a different directory for the RetroArch bios "system" folder. Open RetroArch and lookup Settings > Directory > "System/BIOS" . The very first entry on this list shows where the system directory of RetroArch is setup for you. The Playstation bios files go in that folder.

Can you play any Playstation games? If not, its best to create a log file. I don't know what platform you are using, here is an overview of how to do that for all platforms you have installed RetroArch on: https://docs.libretro.com/guides/generating-retroarch-logs/

[-] thingsiplay@beehaw.org 3 points 1 day ago* (last edited 1 day ago)

You replied to yourself, therefore I did not get any notification.

Just put the bios files in the system directory. They don't need to be scanned. If these are the correct files, then RetroArch will pick them up automatically from this place. All you need is to put those 3 bios files with .bin extension to system folder.

Then you can check if the bios files are missing or correct at Settings > Core > Manage Cores > "Sony - PlayStation (Beetle PSX HW)" or at the core you actually use. Scroll down to the list with the exclamation ~~points~~ marks (!) . They tell you which of them are either "Present" or "Missing".

[-] thingsiplay@beehaw.org 3 points 1 day ago* (last edited 1 day ago)

You are 100% and completely convinced me. Right now I'm in the process of renaming the project and decided to rename the executable too. All your points are on point and is something I would probably say about other projects as well.

As for why I was reluctant to change project name was not only the Github links, in example in the executable and documentation of older version people downloaded. But also the default ignore file I am using with the script, that is created and read/written at "~/.local/share/ytdl" . It will probably annoy people who already downloaded and using it; and I hate that its doing it. But better I do it now that later.

So thank you for this suggestion and explanation.

Edit: I'm going with yt-dlp-lemon , as in easy peasy, lemon squeezy. Probably not as descriptive as you hoped for, but I don't think this is bad.

[-] thingsiplay@beehaw.org 2 points 1 day ago* (last edited 1 day ago)

That's actually a good point, one that I made myself over other projects in the past. Guess I did not think through this entire thing. The script itself is kind of like what an alias means to be, a shorter and simple alias to a more complex command that already exist. In fact it started and got evolved from that. The script is not a project on its own like yt-dlp being independent from youtube-dl. But I admit this is a bad excuse.

I would like to keep the simple and short to remember ytdl executable name. And if anyone wants to, can still rename it to something else when installing. On the other hand the project title and how it is referred to as has ambiguity to it. Changing the readme and some descriptions and titles is not a big deal (in this early stage), but changing the path to the project comes at a huge cost, meaning the Github link.

[-] thingsiplay@beehaw.org 1 points 1 day ago

I like the ergonomics of the Xbox controller a lot (not the original ;-) ), but it would be nice to get rid of the proprietary driver and Microsoft wireless adapter on my Linux PC. Plus it's missing motion sensors, which could be used in Switch emulation or for some cool custom control schemes for Steam games.

[-] thingsiplay@beehaw.org 3 points 1 day ago

RetroArch has a dedicated directory for bios and system files. Usually the Playstation bios goes to "system" folder in RetroArch. It's described here, you need the correct bios files: https://docs.libretro.com/library/beetle_psx_hw/#bios

[-] thingsiplay@beehaw.org 4 points 1 day ago

Wish you the best and good recovery. I assume you also use it as a stationary machine connected to the tv/monitor?

[-] thingsiplay@beehaw.org 3 points 1 day ago

I hope too! I think they did not figure out how to make the controller not too big with the two touch pads, without sacrificing the other important elements. That was one of the deal breaker for the original Steam Controller, alongside the not that much optimal ergonomics in the hand. If Valve can pull off a Steam Controller 2 that is inline with the Steam Deck and is capable of replacing my Xbox controllers, then I would happily pay full price at launch (after reviews off course). It could be the ultimate game controller.

15
submitted 1 day ago* (last edited 1 day ago) by thingsiplay@beehaw.org to c/linux@lemmy.ml

Project name is changed from "ytdl" to "yt-dlp-lemon", after user "lol" in the comments convinced me. Thank you for the suggestion! Remember to change the directory name at ~/.local/share/ytdl to ~/.local/share/yt-dlp-lemon .


The terror continues...

10 days ago I posted the initial version of this script. Since then lot of changed and added. Here some of those changes since v0.1:

  • -h is now much more simple, to see full help use -H
  • -f to repackage to another container format, or -F to force re-encoding video content with a codec to any other format
  • -s and -b will operate on sponsors only, and -S and -B on complete list of SponsorBlock segments
  • similarly -e and -d will only embed and download only a few extra metadata and files, -E and -D does all extra files and data
  • new -R will download and name files in reverse order, with index starting at 1 for the bottom file, useful for playlists who add newest entry to top
  • by default all file names are simplified and sanitized a little bit, even if no option -r (for very strict) is used

My goal is to make the usage of yt-dlp itself easier with this script, without the need to study help, the manual and to write a configuration file and a script. And you don't need to test it with various sources. It does not everything what yt-dlp offers, but most of the stuff in the way I like it.

git clone https://github.com/thingsiplay/yt-dlp-lemon
cd yt-dlp-lemon
chmod +x yt-dlp-lemon
./yt-dlp-lemon -h

Output from simple help:

$ yt-dlp-lemon -h
yt-dlp-lemon [options] [url...]

Simple wrapper to yt-dlp with only a subset of options.

options:
-h                show help and exit
-H                show all options, notes and exit
-m HEIGHT         max height
-f FORMAT         repack format
-I                no ignore file
-s                add chapter marks + recognize sponsors
-b                remove sponsored segments
-c                split file by chapters
-p                playlist mode
-a                audio mode
-d                download description files
-e                embed meta and chapters
-q                show filepath only
-x                skip download

Copyright © 2024 Tuncay D. https://github.com/thingsiplay/yt-dlp-lemon
51
submitted 1 week ago* (last edited 1 week ago) by thingsiplay@beehaw.org to c/linux@lemmy.ml

Today I'm here again to terrorize this community with my Bash scripts nobody asked for.

This new biggest is a script evolved from a much simpler version found at biggest.sh to something more complex and complete. Now there are even options to show a simple horizontal bar and relative percentage numbers instead the file size itself.

It's a script to control du command in combination with several other standard Linux utilities. I'm well aware of these alternative applications to help visualizing what the biggest files on the system are. Well, I like these kind of scripts and I like its not too much bloated. And especially the output as paths can be combined with other tools easily. It's also kinda fun doing this. Edit: Forgot to mention, it also reads stdin pipe, as output from another program like find in example.

Have a good day.

35
submitted 1 week ago by thingsiplay@beehaw.org to c/linux@lemmy.ml

ytdl is a small script for Linux as an alternative interface to yt-dlp (which itself is a fork from youtube-dl, to download YouTube videos). My goal is to make some of its functionality a bit more accessible for the daily usage. This includes predefined settings and narrowing it down to options I care most about.

7
submitted 2 weeks ago* (last edited 2 weeks ago) by thingsiplay@beehaw.org to c/python@programming.dev

Solved: Thanks to a user with this reply: https://programming.dev/comment/10034690


cross-posted from: https://beehaw.org/post/13901165

Hi all. I have a little problem and don't know how to solve. A CLI program in Python is broken since Python 3.12. It was working in Python 3.11. The reason is, that Python 3.12 changed how subclassing of a pathlib.Path works (basically fixed an issue), which now breaks a workaround.

The class in question is:

class File(PosixPath):
    def __new__(cls, *args: Any, **kwargs: Any) -> Any:
        return cls._from_parts(args).expanduser().resolve()  # type: ignore

    def __init__(self, source: str | Path, *args: Any) -> None:
        super().__init__()
        self.__source = Path(source)

    @property
    def source(self) -> Path:
        return self.__source

    @property
    def modified(self) -> Time:
        return Time.fromtimestamp(os.path.getmtime(self))

    @property
    def changed(self) -> Time:
        return Time.fromtimestamp(os.path.getctime(self))

    @property
    def accessed(self) -> Time:
        return Time.fromtimestamp(os.path.getatime(self))

    # Calculate sha512 hash of self file and compare result to the
    # checksum found in given file. Return True if identical.
    def verify_sha512(self, file: File, buffer_size: int = 4096) -> bool:
        compare_hash: str = file.read_text().split(" ")[0]
        self_hash: str = ""
        self_checksum = hashlib.sha512()
        with open(self.as_posix(), "rb") as f:
            for chunk in iter(lambda: f.read(buffer_size), b""):
                self_checksum.update(chunk)
            self_hash = self_checksum.hexdigest()
        return self_hash == compare_hash

and I get this error when running the script:

Traceback (most recent call last):
File "/home/tuncay/.local/bin/geprotondl", line 1415, in 
sys.exit(main())
^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1334, in main
arguments, status = parse_arguments(argv)
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1131, in parse_arguments
default, status = default_install_dir()
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1101, in default_install_dir
steam_root: File = File(path)
^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 97, in __new__
return cls._from_parts(args).expanduser().resolve()  # type: ignore
^^^^^^^^^^^^^^^
AttributeError: type object 'File' has no attribute '_from_parts'. Did you mean: '_load_parts'?

Now replacing _from_parts with _load_parts does not work either and I get this message in that case:

Traceback (most recent call last):
File "/home/tuncay/.local/bin/geprotondl", line 1415, in 
sys.exit(main())
^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1334, in main
arguments, status = parse_arguments(argv)
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1131, in parse_arguments
default, status = default_install_dir()
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1101, in default_install_dir
steam_root: File = File(path)
^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 97, in __new__
return cls._load_parts(args).expanduser().resolve()  # type: ignore
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/pathlib.py", line 408, in _load_parts
paths = self._raw_paths
^^^^^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute '_raw_paths'

I have searched the web and don't understand how to fix this. Has anyone an idea what to do?

13
submitted 2 weeks ago* (last edited 2 weeks ago) by thingsiplay@beehaw.org to c/programming@programming.dev

Solution was quite easy. Thanks to the user reply here: beehaw.org/comment/3535588 or programming.dev/comment/10034690 (Not sure if the links actually work as expected...)


Hi all. I have a little problem and don't know how to solve. A CLI program in Python is broken since Python 3.12. It was working in Python 3.11. The reason is, that Python 3.12 changed how subclassing of a pathlib.Path works (basically fixed an issue), which now breaks a workaround.

The class in question is:

class File(PosixPath):
    def __new__(cls, *args: Any, **kwargs: Any) -> Any:
        return cls._from_parts(args).expanduser().resolve()  # type: ignore

    def __init__(self, source: str | Path, *args: Any) -> None:
        super().__init__()
        self.__source = Path(source)

    @property
    def source(self) -> Path:
        return self.__source

    @property
    def modified(self) -> Time:
        return Time.fromtimestamp(os.path.getmtime(self))

    @property
    def changed(self) -> Time:
        return Time.fromtimestamp(os.path.getctime(self))

    @property
    def accessed(self) -> Time:
        return Time.fromtimestamp(os.path.getatime(self))

    # Calculate sha512 hash of self file and compare result to the
    # checksum found in given file. Return True if identical.
    def verify_sha512(self, file: File, buffer_size: int = 4096) -> bool:
        compare_hash: str = file.read_text().split(" ")[0]
        self_hash: str = ""
        self_checksum = hashlib.sha512()
        with open(self.as_posix(), "rb") as f:
            for chunk in iter(lambda: f.read(buffer_size), b""):
                self_checksum.update(chunk)
            self_hash = self_checksum.hexdigest()
        return self_hash == compare_hash

and I get this error when running the script:

Traceback (most recent call last):
File "/home/tuncay/.local/bin/geprotondl", line 1415, in 
sys.exit(main())
^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1334, in main
arguments, status = parse_arguments(argv)
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1131, in parse_arguments
default, status = default_install_dir()
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1101, in default_install_dir
steam_root: File = File(path)
^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 97, in __new__
return cls._from_parts(args).expanduser().resolve()  # type: ignore
^^^^^^^^^^^^^^^
AttributeError: type object 'File' has no attribute '_from_parts'. Did you mean: '_load_parts'?

Now replacing _from_parts with _load_parts does not work either and I get this message in that case:

Traceback (most recent call last):
File "/home/tuncay/.local/bin/geprotondl", line 1415, in 
sys.exit(main())
^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1334, in main
arguments, status = parse_arguments(argv)
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1131, in parse_arguments
default, status = default_install_dir()
^^^^^^^^^^^^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 1101, in default_install_dir
steam_root: File = File(path)
^^^^^^^^^^
File "/home/tuncay/.local/bin/geprotondl", line 97, in __new__
return cls._load_parts(args).expanduser().resolve()  # type: ignore
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/pathlib.py", line 408, in _load_parts
paths = self._raw_paths
^^^^^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute '_raw_paths'

I have searched the web and don't understand how to fix this. Has anyone an idea what to do?

48
My Linux Command Line Tools (thingsiplay.game.blog)
submitted 2 weeks ago by thingsiplay@beehaw.org to c/linux@lemmy.ml

A short list with categories of my smol terminal focused tools, scripts and functions I have created over the years. There are some general purpose and very specific ones. This list was needed, because in Github it was a bit cluttered. Maybe, just maybe, you find something useful or inspiring in there.

17
submitted 2 weeks ago by thingsiplay@beehaw.org to c/linux@lemmy.ml

A week ago I started a little script to format the output of file and path listings from other programs. It got a little bit out of hand and I implemented lot of advanced features into the fmt commands; kind of a sub language to define how the output should be formatted and structured. Entire idea is to give it paths, process the stream (not the file content itself, but the path representing a file) and output them again.

fpath accepts two type of input: a) either as arguments like fpath *.txt or b) from stdin like ls -1 | fpath . With additional options and commands the output can be colored and reformatted to something entirely different. In example with -F option the advanced formatting is possible, such as fpath -F '{.size} {name}' as a simple example.

There is lot of functionality (based on Python, yes this is a Python script), such as {reverse}{name}{/reverse} to reverse font color and background of the segment that is enclosed by the command, a slice to get a subset as a range from the entire path {-1:}, or {center:80}text{/center} to add spaces to get centered text, or just {ext} to output the extension, {mime} to output the file mime type, or even execute arbitrary programs {!grep:a}{path}{/!} to reduce output that has an a in the path.

Did I over engineer it again? Or just ignore most stuff and use it with the most simple options, should be enough anyway: fpath -t -s red *.txt

60
submitted 2 weeks ago* (last edited 2 weeks ago) by thingsiplay@beehaw.org to c/gaming@beehaw.org

I just watched an excellent 2 hour (just needed to edit title, as I noticed it was 2 hours and not 1, wow time really flew away!) long documentary. The build up in stages and showing the evolution of the best players achievements, is intense and very well edited, narrated and written documentary!

I know 1 hour is long and I wasn't planning to watch everything, but time flew away. If you have any slight interest into this topic, I highly recommend you to take some time to watch. The video itself is broken up in 5 or so sections. So you could just watch a section at a time, if 2 hour is too long. There is a specific reveal that I do not want spoil, which was epic. Just insanity!

BTW have fun. Edit: Here some timestamps:

  1. 2:32 Chapter 1
  2. 11:39 Chapter 2
  3. 16:28 Chapter 3: ENEOOGEZ
  4. 25:48 Chapter 4: Hypertapping
  5. 31:45 Chapter 5: The Next Generation
  6. 49:00 Chapter 6: Rolling
  7. 1:00:27 Chapter 7: Vaulting & Scaling
  8. 1:15:25 Chapter 8: Colors
  9. 1:25:00 Chapter 9: Crash

For anyone who don't want to watch it on YouTube, here is a link to an Invidious instance:

https://invidious.nerdvpn.de/watch?v=mOJlg8g8_yw

11
submitted 3 weeks ago* (last edited 2 weeks ago) by thingsiplay@beehaw.org to c/linux@lemmy.ml

Hi all. Yesterday I posted a program/script which is focused on path based text formatting, such as output from ls or find. Today I want to share new version. I'm proud, even though its limited in its usefulness, but today I solved an issue that was complicated to me (and a few other issues).

Linux command file is used to display file type and mime information, which is super handy. Reason why this was complicated to me is, as I want it to run only once for all paths together for performance reasons. For over thousand files instead taking more than a minute execution time, its down to under 2 seconds when displaying file type information (which includes spawning file process in the background). A few examples:

$ find Desktop/*.* -maxdepth 0 | fpath -F'{type}   \t{name}'
text/plain      append.cfg
text/plain      dynamic.cfg
image/png       nearest.png
image/png       new.png

$ find Desktop/*.* -maxdepth 0 | fpath -a -F'{path}\n\t{file}'
/home/tuncay/Desktop/append.cfg
        ASCII text
/home/tuncay/Desktop/dynamic.cfg
        ASCII text
/home/tuncay/Desktop/nearest.png
        PNG image data, 1920 x 1440, 8-bit/color RGB, non-interlaced
/home/tuncay/Desktop/new.png
        PNG image data, 1920 x 1440, 8-bit/color RGB, non-interlaced

Update v0.3:

Rather than creating a new post, I want to note that I have a huge update. First off, the performance is increased drastically with recent optimizations. Even thousands of paths are now processed very fast (until operations reading from file system is involved).

Just to put into perspective: When I search and output list of paths with time baloosearch6 "a" in my home, I get 8468 files and it takes 0m0,048s. Now when I pipe that into fpath with default processing and without options, it takes 0m0,086s to process. But with a more complex command that involves reading file stats (like size and such) and colored output and a slice:

time baloosearch6 "a" | fpath -F'{.mode}  {.size} \t{-3:-1}: {blue}{name} {}' -sred

it only takes 0m0,200s to execute! But using {file} or {type} or {mime} will still take a long time, even if the subshell process is run only once (it will still read the information for every file):

time baloosearch6 "a" | fpath -F'{file}'

took 3m54,233s to run. But what do you expect with approx. 8 thousand files. Without this script, it would take the same amount of time when running bare metal file command on all of these files.

Secondly, I have implemented a slice command that works very well. It's like the index {3} thing, but now you can set a {start:end} range to not only get a single part, but all parts within that range. It even works with negative numbers like {-3:} to get the last three parts of a path. An empty index means to get everything until end of path.

I'm quite happy how this program turned to be out. Python (at least for me with Python v3.12) is not that slow after all.

23
submitted 3 weeks ago by thingsiplay@beehaw.org to c/linux@lemmy.ml

I did it again; exaggerate a simple idea and make it look more complicated at the end with too much text in the readme. I was bothered with the output of file listings and how unreadable they can get, especially with long paths and many of them on screen. At the end, I am not sure how useful this will be in the long run, but that is something you can judge yourself. It was certainly fun to create and in my opinion it's also fun to use.

git clone https://github.com/thingsiplay/fpath
cd fpath
chmod +x fpath


What is this? Convenience script to style and reformat the output with path like formats. Designed to combine listings from other programs output, such as from find and even ls, or any other tool with similar capabilities. The script works mostly on text data rather than the file system, but some special commands are exception to this rule and will access the file system.


116
submitted 3 weeks ago* (last edited 3 weeks ago) by thingsiplay@beehaw.org to c/foss@beehaw.org

New features and improvements

  • Improved support for tablets on Windows
  • Backports of other GTK3 features

What’s next

Clearly one of the smallest releases ever in the 2.10 series, and it might be our last. We’ll see, though we also know some people get stuck longer than others on older series (especially when using LTS distributions of Free Software operating systems), so we might do (if we feel like it’s needed) a 2.10.40 release with bug fixes only just before or just after GIMP 3.0.0 release, as a wrap up.

In any case, we are now stopping backporting features in the 2.10 series. These graphics tablet support improvements for Windows are huge enough that they had to get in; yet from now on, we want to focus solely on releasing GIMP 3.0.0.

Now you might wonder when that is? Very soon! We are on the last sprint towards the release candidate. This includes a lot of bug fixes, but also still some API changes going on. We will keep you updated!

Don’t forget you can donate and personally fund GIMP developers, as a way to give back and accelerate the development of GIMP. Community commitment helps the project to grow stronger! 💪🥳


GIMP 3.0 (Development branch roadmap

view more: next ›

thingsiplay

joined 11 months ago