mirror of
https://github.com/dewomser/Toot_music_is_playing.git
synced 2026-03-13 16:37:17 +01:00
Twitter funktion entfernt. Ist aber noch im Branch archiv vorhanden.
This commit is contained in:
parent
61b767bb25
commit
25d715e353
2 changed files with 2 additions and 144 deletions
20
README.md
20
README.md
|
|
@ -1,4 +1,4 @@
|
||||||
# Tweet_and_toot_music_is_playing
|
# Toot_music_is_playing
|
||||||
[](https://github.com/dewomser/Tweet_and_toot_music_is_playing/actions/workflows/main.yml) Shellchecked
|
[](https://github.com/dewomser/Tweet_and_toot_music_is_playing/actions/workflows/main.yml) Shellchecked
|
||||||
|
|
||||||
2 Shellscripts for Linux/KDE
|
2 Shellscripts for Linux/KDE
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
Finds Metatags of Audio-Players
|
Finds Metatags of Audio-Players
|
||||||
* VLC
|
* VLC
|
||||||
* Clementine (KDE)
|
* Clementine (KDE)
|
||||||
|
* (Strawberry)
|
||||||
* Elisa (KDE)
|
* Elisa (KDE)
|
||||||
* Chrome und Firefox mit Plasma-integration
|
* Chrome und Firefox mit Plasma-integration
|
||||||
|
|
||||||
|
|
@ -22,21 +23,4 @@ Bonus: Suggestion yt
|
||||||
Example:
|
Example:
|
||||||

|

|
||||||
|
|
||||||
## tweet_music ist kaputt
|
|
||||||
## Twitter hat im Mai 2023 twurl abgeschaltet
|
|
||||||
|
|
||||||
Finds Metatags of Audio-Players
|
|
||||||
* VLC
|
|
||||||
* Clementine (KDE)
|
|
||||||
* Elisa (KDE)
|
|
||||||
* Chrome und Firefox mit Plasma-integration
|
|
||||||
|
|
||||||
and sends as a Tweet to your Twitter-account
|
|
||||||
|
|
||||||
Needs Linux with mpris, Bash, [Twurl](https://github.com/twitter/twurl)
|
|
||||||
|
|
||||||
Twurl needs to be be authorized by Twitter
|
|
||||||
|
|
||||||
Bonus: Suggests a Link to yt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,126 +0,0 @@
|
||||||
## ACHTUNG Twurl wurde im Mai 2023 von TWitter abgeschaltet.
|
|
||||||
## FUNKTIONIERT NICHT MEHR !
|
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
#//config
|
|
||||||
BASEDIR=$(readlink -f "$0" | xargs dirname)
|
|
||||||
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
|
||||||
unset linkohnecover
|
|
||||||
declare -a a
|
|
||||||
#Path twurl is not EXPORT
|
|
||||||
twurlp="/home/karl/.gem/bin/twurl"
|
|
||||||
user="dewomser"
|
|
||||||
#list of available player
|
|
||||||
list_pl=( "clementine" "vlc" "elisa" "plasma-browser-integration" )
|
|
||||||
#active player
|
|
||||||
for i in "${list_pl[@]}"
|
|
||||||
do
|
|
||||||
pl=$(qdbus org.mpris.MediaPlayer2."$i" /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlaybackStatus 2>&1)
|
|
||||||
if [ "$pl" == "Playing" ]
|
|
||||||
then
|
|
||||||
player="$i"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$player" == "" ]
|
|
||||||
then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
#get metadata fromplayer
|
|
||||||
#Plasma-browser-integration wget cover
|
|
||||||
if [ "$player" == "plasma-browser-integration" ]
|
|
||||||
then
|
|
||||||
a[6]="$(qdbus org.mpris.MediaPlayer2."$player" /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep -E url: | sed -e 's/xesam://g')"
|
|
||||||
|
|
||||||
lolo4=$(qdbus org.mpris.MediaPlayer2."$player" /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep -E artUrl | sed -e 's/mpris:artUrl://g')
|
|
||||||
if [ -z "$lolo4" ]; then a[0]="nocover.jpg"
|
|
||||||
if [ "${a[6]}" ] && [ -z "${lolo4}" ]; then linkohnecover=1 ;fi
|
|
||||||
|
|
||||||
else
|
|
||||||
lolo3="wget $(qdbus org.mpris.MediaPlayer2."$player" /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep -E artUrl | sed -e 's/mpris:artUrl://g')"
|
|
||||||
$lolo3 -O cover.jpg
|
|
||||||
a[0]=cover.jpg
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
a[0]="$(qdbus org.mpris.MediaPlayer2."$player" /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep -E artUrl: | sed -e 's/mpris:artUrl: file:\/\///g')"
|
|
||||||
if [ -z "${a[0]}" ]; then a[0]="nocover.jpg"; fi
|
|
||||||
fi
|
|
||||||
a[1]="$(qdbus org.mpris.MediaPlayer2."$player" /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep -E artist: | sed -e 's/xesam://g')"
|
|
||||||
if [ -z "${a[1]}" ]; then a[1]="Artist: ohne"; fi
|
|
||||||
|
|
||||||
a[2]="$(qdbus org.mpris.MediaPlayer2."$player" /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep -E album: | sed -e 's/xesam://g')"
|
|
||||||
if [ -z "${a[2]}" ]; then a[2]="Album: ohne"; fi
|
|
||||||
|
|
||||||
a[4]="$(qdbus org.mpris.MediaPlayer2."$player" /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata | grep -E title: | sed -e 's/xesam://g')"
|
|
||||||
if [ -z "${a[4]}" ]; then a[4]="Title: ohne"; fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ -z "${a[6]}" ]; then a[6]="Medialink: ohne"; fi
|
|
||||||
|
|
||||||
#//Bild kopieren
|
|
||||||
lolo1=$(urldecode "${a[0]}")
|
|
||||||
# grüne Zeile
|
|
||||||
convert "$lolo1" -gravity south -background YellowGreen -splice 0x18 -annotate +0+2 'Die Tweet_Music-App ist vom @dewomser' "$BASEDIR"/cover.jpg
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Daten an den Twitterclient
|
|
||||||
a[5]="https://www.youtube.com/results?search_query=${a[2]// /+}+${a[4]// /+}"
|
|
||||||
lolo="${a[5]}"
|
|
||||||
|
|
||||||
text1=$"ich höre gerade:"
|
|
||||||
text="$text1
|
|
||||||
${a[4]}
|
|
||||||
${a[2]}
|
|
||||||
${a[1]}
|
|
||||||
Media-player: $player
|
|
||||||
Video (geraten): $(echo "$lolo" | iconv -c -f UTF-8 -t ASCII//TRANSLIT)
|
|
||||||
${a[6]} "
|
|
||||||
|
|
||||||
# Workaraound link mag keine Unlaute in der URL
|
|
||||||
# text="$(echo "$text2" | iconv -c -f UTF-8 -t ASCII//TRANSLIT)"
|
|
||||||
|
|
||||||
|
|
||||||
# Nur zur Kontrolle
|
|
||||||
echo "komlpetter text tweet"
|
|
||||||
echo "$text"
|
|
||||||
echo "++Ende++"
|
|
||||||
echo Cover
|
|
||||||
echo "${a[0]}"
|
|
||||||
|
|
||||||
if [ $linkohnecover ]
|
|
||||||
then
|
|
||||||
echo "link ohne text"
|
|
||||||
else
|
|
||||||
echo "cover"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Test ohne twittern
|
|
||||||
#exit
|
|
||||||
|
|
||||||
# Ab geht die Twitterpost
|
|
||||||
|
|
||||||
if [ $linkohnecover ]
|
|
||||||
then
|
|
||||||
$twurlp -u $user "/1.1/statuses/update.json" -d "status=$text"
|
|
||||||
else
|
|
||||||
#// Bildgröße in Byte ermitteln
|
|
||||||
byte=$(du -b cover.jpg | grep -Eo "^[0-9]+")
|
|
||||||
#// initialisieren
|
|
||||||
mis=$($twurlp -u $user -H upload.twitter.com "/1.1/media/upload.json" -d "command=INIT&media_type=image/jpg&total_bytes=$byte" | jq -r .media_id_string)
|
|
||||||
# jq -r macht das jetzt mis="${mis:1: -1}"
|
|
||||||
|
|
||||||
#//hochladen
|
|
||||||
$twurlp -u $user -H upload.twitter.com "/1.1/media/upload.json" -d "command=APPEND&media_id=$mis&segment_index=0" --file "$BASEDIR"/cover.jpg --file-field "media" | jq .
|
|
||||||
|
|
||||||
|
|
||||||
#//finalisieren
|
|
||||||
$twurlp -u $user -H upload.twitter.com "/1.1/media/upload.json" -r "command=FINALIZE&media_id=$mis" | jq .
|
|
||||||
|
|
||||||
|
|
||||||
#//text hinzufügen
|
|
||||||
$twurlp -u $user "/1.1/statuses/update.json" -d "media_ids=$mis&status=$text"
|
|
||||||
|
|
||||||
fi
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue