Code Monkey home page Code Monkey logo

mpdq's Introduction

ReadMe Card

Why I code

I am very motivated by "Hey, that program doesn't work the way I want it to! Let's bend it to my will!" While my code isn't always optimized, I've worked pretty hard to make it:

  1. A learning experience for me that fixes a problem/need I have.
  2. Easy to figure out how it works
  3. Resistant to bitrot ( shakes fist at all the abandoned python2 programs )
  4. Able for someone else to come along and fix any bitrot that happens if I'm not able or around to do it myself.

That's led to a lot of these being in BASH. There's some BASHisms throughout, so they're not exactly POSIX-compliant, but hopefully they're close enough that someone who is better at such than I can easily tweak them.


Programming Work

Create side and top bars in tmux easily, along with a "devour" style command.

Modular scripts to take text, images, and links from RSS feeds and push to social media

A script in bash (with some assorted tools) to collect info about available bandwidth and to perform traffic shaping

A script to output who all is actively connected to your DD-WRT router

A selfhosted way to create images with quotations using fortune, imgmagick, and unsplash.it to create your own quotation porn.

Automatic MPD "smart playlist" creator in bash with minimal but hackable setup.

Clean a series of links, resolving redirects and finding Wayback results if page is gone

Enhanced, modular, bookmarking for newsboat, newsbeuter, or (for that matter) anything that can pass a title and an URL to a program.

Transform your e-mail newsletters into webpages and an RSS feed.

A GUI/TUI addressbook searcher/viewer for use with a mess of vcards

Find the right manpage or cheatsheet, easily.

Parsing and converting documents on the fly in the terminal (or with a terminal popup)

BASH/YAD script to Read and fix PDF tags in filenames and exif metadata

Simplifying (I hope) UFW and iptables, includes a utility to get blocklists and incorporate them.

Download and display album art or display embedded (or folder-based) album art. Designed to work with MPD, the music player daemon.

A bash script to get the weather from OpenWeatherMap and output to the terminal, Openbox, or HTML

Various music-related tweaks/tips/scripts. Includes fuzzy selection of artist/genre/album script and albumart in the console script

Using BASH to create a quick web based lyrics/art view of a playing MPD instance, and using BASH and CGI to implement a web-based remote control for MPD.

mpdq's People

Contributors

uriel1998 avatar xeruf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mpdq's Issues

Infinite loop with wrong parameters

I read somewhere (old/outdated guide) that the command is mpdq file.txt, without -c.

Instead of some error, it just looped forever in the while.

set -x works great for debugging

When password is not set...

I run MPD with no password.

When not using a password, mpdq throws an error (owing to it still prepending hostname with '@'. )

I modified script to get around this, no doubt you will find a more elegant solution than I did.

Also I couldn't install wc or bc on my distro.

Errors! unary operator error 495, sed errors.

$ mpdqcfg="$XDG_CONFIG_HOME/mpdq"
$ [[ -f "$mpdqcfg/mpdq.ini" ]] && echo "mpdq.ini exists" && [[ -f "$mpdqcfg/default.cfg" ]] && echo "default.cfg exists"
mpdq.ini exists
default.cfg exists

$ python3 --version; uname -a; ./mpdq --version
Python 3.10.12
Linux gigabyte 6.5.0-21-generic #21~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb  9 13:32:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux


$ cat "$XDG_CONFIG_HOME/mpdq/mpdq.ini"|sed 's/mpdpass=.*/mpdpass=[-redacted-]/'; [[ -d /library/music ]] && echo "musicdir exists" ; which ffprobe; \mpc -p 6600 -h localhost stats; \mpc
[SERVER]
musicdir=/library/music
mpdserver=localhost
mpdport=6600
mpdpass=[-redacted-]
songlength=15
queuesize=10
# in hours
rotate_time=1
# in minutes
album_mins=30
artist_mins=30
# Genres to exclude from the above two checks
genres_exclude_album_check=Sound Clip,Classical
musicinfo=/usr/bin/ffprobe
musicdir exists
/usr/local/bin/ffprobe
/usr/bin/ffprobe
/bin/ffprobe
Artists:   5473
Albums:    3737
Songs:    62381

Play Time:    0 days, 0:32:59
Uptime:       0 days, 0:53:02
DB Updated:   Fri Mar  1 08:07:05 2024
DB Play Time: 195 days, 8:01:36
volume: n/a   repeat: off   random: off   single: off   consume: on 
 $ head $mpdqcfg/default.cfg
=1
(Ninguno)=1
2-Step, Downtempo, Electronic, Future Garage, House; Electronic Music; Electronica=1
A Capella Pop=1
A Cappella=1
A Cappella; Country Blues, Folk; Gospel Music=1
A Cappella; Western Classical Music=1
AOR Classic Rock=1
Acid House, Alternative Rock, Downtempo, Dub, Dub Techno; Alternative Rock=1
Acid House, Alternative Rock, Downtempo, Dub, Pop; Alternative Rock=1
$ ./mpdq -c "$mpdqcfg/mpdq.ini" --loud &>> /cache/mpdq.error &
$ cat /cache/mpdq.error 
Loading instruction file commands
sed: -e expression #1, char 0: no previous regular expression
Adding :
./mpdq: line 495: [: 1: unary operator expected
Adding :(Ninguno)
./mpdq: line 495: [: 1: unary operator expected
Adding :2-Step, Downtempo, Electronic, Future Garage, House; Electronic Music; Electronica
./mpdq: line 495: [: 1: unary operator expected
Adding :A Capella Pop
./mpdq: line 495: [: 1: unary operator expected
Adding :A Cappella
./mpdq: line 495: [: 1: unary operator expected
Adding :A Cappella; Country Blues, Folk; Gospel Music
./mpdq: line 495: [: 1: unary operator expected
Adding :A Cappella; Western Classical Music
./mpdq: line 495: [: 1: unary operator expected
Adding :AOR Classic Rock
./mpdq: line 495: [: 1: unary operator expected
⋮
Eliminating song log entries older than 1 hours.
Using instruction file at /home/bvargo/.config/mpdq/default.cfg
Search run 1 of 2475
Examining Hip Hop Music; Pop, Pop Rock, Rock
Default 1 :: Played 1 :: Weight 1
Used up Hip Hop Music; Pop, Pop Rock, Rock
Iteration!
Search run 2 of 2475
Examining Pop Music; Pop Rock, Soft Rock
Default 1 :: Played 2 :: Weight 1
Used up Pop Music; Pop Rock, Soft Rock
Iteration!
Search run 3 of 2475
Examining Funk, Pop, Rock, Rock And Roll, Soul
Default 1 :: Played 1 :: Weight 1
Used up Funk, Pop, Rock, Rock And Roll, Soul
Iteration!
⋮
Search run 32 of 2475
Examining Soul, R&B, funk, hip hop
Default 1 :: Played 1 :: Weight 1
Used up Soul, R&B, funk, hip hop
Iteration!
Search run 33 of 2475
Examining Rock / Pop
sed: -e expression #1, char 10: extra characters after command
sed: -e expression #1, char 10: extra characters after command
Default 1 :: Played 0 :: Weight 1
Adding song from Mark Knopfler by Mark Knopfler in the Rock / Pop genre.
[1]+  Done                    ./mpdq -c $XDG_CONFIG_HOME/mpdq/mpdq.ini --loud &>> /cache/mpdq.error
 cat mpdq.error |grep sed|head -40
sed: -e expression #1, char 0: no previous regular expression
sed: -e expression #1, char 19: extra characters after command
sed: -e expression #1, char 23: unknown command: `S'
sed: -e expression #1, char 22: extra characters after command
sed: -e expression #1, char 16: extra characters after command
sed: -e expression #1, char 31: unknown command: `S'
sed: -e expression #1, char 11: extra characters after command
sed: -e expression #1, char 9: extra characters after command
sed: -e expression #1, char 42: unknown command: `S'
sed: -e expression #1, char 29: unknown command: `S'
sed: -e expression #1, char 9: unknown command: `S'
sed: -e expression #1, char 20: unknown command: `S'
sed: -e expression #1, char 9: unknown command: `S'
sed: -e expression #1, char 14: unknown command: `B'
sed: -e expression #1, char 12: extra characters after command
sed: -e expression #1, char 12: extra characters after command
sed: -e expression #1, char 25: extra characters after command
sed: -e expression #1, char 22: extra characters after command
sed: -e expression #1, char 6: unknown command: `S'
sed: -e expression #1, char 7: unknown command: `S'
sed: -e expression #1, char 10: extra characters after command
sed: -e expression #1, char 10: extra characters after command
sed: -e expression #1, char 7: unknown command: `E'
sed: -e expression #1, char 8: extra characters after command
sed: -e expression #1, char 8: extra characters after command
sed: -e expression #1, char 9: unknown command: `S'
sed: -e expression #1, char 9: unknown command: `S'
sed: -e expression #1, char 9: unknown command: `B'
sed: -e expression #1, char 0: no previous regular expression
sed: -e expression #1, char 0: no previous regular expression
Used up 
sed: -e expression #1, char 0: no previous regular expression
sed: -e expression #1, char 0: no previous regular expression
Used up 
sed: -e expression #1, char 0: no previous regular expression
sed: -e expression #1, char 0: no previous regular expre

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.