#!/bin/bash # Filename: clean-scrape.sh # Version.: 05082018 # Author..: robz # Clean list of magnet links from "showRSS.info" page source scrape. # Add to your file browser scripts directory for right click usage. # Usage: In the web browser, right click - "View Page Source" - "Select All" # left click - drag to desktop - right click - run script cd '/home/robz/Desktop' [ -e 'dropped text.txt' ] || exit sed '/1080p\|720p/d;/href="magnet/!d;s/.*href="//;s/" .*//' 'dropped text.txt' \ | sort -t= -k3 -o 'dropped text.txt' mv 'dropped text.txt' 'add-magnet.txt' exit
Mint Serena 64 bit using the Mate desktop environment. Most of the following scripts will run on this machine, although some have only been tested with the Gnome desktop. Extra software requirements can be met by the Ubuntu and safe PPA repositories. Scripts may be re-written or added to from time to time, the date serves as the version number. Syntax highlighting on these pages is provided by GVim's "Convert to HTML" option.
Showing posts with label media. Show all posts
Showing posts with label media. Show all posts
Clean Scrape
Fix Subtitle Offset
#!/bin/bash # Filename: srt-fix-offset.sh # Version.: 20052018 # Author..: not robz # A script to modify subtitle offset beyond the Kodi maximum of 60 seconds. # Put original titles in a file called "srt.txt" in your home directory and # run the script. # In all honesty this is pretty much a copy paste job from Linux Questions. # For more detailed information goto: # www.linuxquestions.org/questions/linux-newbie-8/editing-srt-files-4175436550/ # # Modify and comment the offset variable as appropriate. # Advance subtitles. offset="75 seconds" # Retard subtiles. #offset="5 seconds ago" while read start s end; do if [[ $start =~ ^..:..:..,... ]]; then start=$(date -d "$start $offset" +%H:%M:%S,%N) end=$(date -d "$end $offset" +%H:%M:%S,%N) echo ${start:0:12} $s ${end:0:12} else echo $start $s $end fi done < srt.txt >> new-subtitles.srt
DAB Radio
#!/bin/bash # Filename: dab-radio.sh # Version.: 07022018 # Author..: robz # Basic DAB radio via a cheap DVB-T dongle using a "zenity" gui and the command # line version of "vlc player", see man vlc. The utility "wmctrl" places the gui # top left of the screen. The initial scanning for radio stations I used the # "w_scan" utility to create a playlist text file. text="Make a selection" optn=":dvb-frequency=522000000 :dvb-bandwidth=8 :dvb-ts-id=4168 \ :dvb-code-rate-hp=2/3 :dvb-modulation=64QAM :dvb-transmission=8 \ :dvb-guard=1/32 :program=" get_mplex () { prog=$(zenity --list --radiolist --height=400 --width=200 --hide-header \ --title='robz DAB Radio' --text="$text" --column '' --column '' --column '' \ --hide-column=3 --print-column=ALL --ok-label='Play' \ FALSE 'BBC Radio 1' '6720' \ FALSE 'BBC Radio 1 Extra' '5888' \ FALSE 'BBC Radio 2' '6784' \ FALSE 'BBC Radio 3' '6848' \ FALSE 'BBC Radio 4' '6912' \ FALSE 'BBC Radio 4 Extra' '5824' \ FALSE 'BBC World Service' '6016' \ FALSE 'BBC Radio 5 Live' '5632' \ FALSE 'BBC Radio 5 Sport' '5696' \ FALSE 'BBC Radio 6 Music' '5760' \ FALSE 'BBC Manchester' '6152' \ FALSE 'BBC Lancashire' '6216' ) } while true; do (sleep .5 && wmctrl -r "robz DAB Radio" -e 1,0,0,200,400) & get_mplex text="<b>Playing: $(cut -d'|' -f1 <<< $prog)</b>" prog="$(cut -d'|' -f2 <<< $prog)" pkill -9 vlc if [ "$prog" = '' ]; then exit; fi (cvlc dvb-t:// $optn$prog > /dev/null 2>&1) & done
Own Media
#!/bin/bash # Filename: own-media # Version: 090813 # Author: robz # The purpose of this script is to automate the transfer of TV media files # from another user account to my standard working account. # Source and destination directories will need changing to suit. # You can use this as a Nautilus script or via a launcher. You will need the # excellent "tvnamer" utility available from the Ubuntu Software Centre. # Ask for password to obtain administrator privileges. if [ "$UID" != "0" ]; then sudo -k; exec gksudo --message "$(echo\ 'Enter your password please, you need root';\ echo 'privilages to access another user account.')"\ "$0" fi USE="robz1" # This scripts destination user name. BAK="$IFS" # Backup internal field separator. IFS="\n" # Set internal field separator. DES="/home/robz1/Torrents/Complete/" # Save directory minus one level. ARC="/media/Backup/TV" # Backup achive location. trap 'IFS="$BAK"; exit' INT TERM EXIT # Restore IFS on exit. # Select files to be copied. FIL=$(zenity --file-selection --multiple --separator=$'\n'\ --filename="/home/transmission/Downloads/Torrents/Complete/"\ --title="Own-Media - >>SELECT FILE OR FILES<<") if [ "$?" = 1 ]; then exit $?; fi # Kill script on cancel. # File destination, this appends to the "$DES" initial destination variable. STO=$(zenity --title="Own-Media" --text="Select Destination" --height=170\ --list --radiolist --column "Select" --column "Send Files To..."\ TRUE "NewTV" FALSE "Somewhere else") # Change "NewTV" to whatever you want. if [ "$?" = 1 ]; then exit $?; fi SAV="$DES""$STO""/" # Set initial destination. # Select alternative file destination, ignore "$DES" and go somewhere else. if [ "$STO" = "Somewhere else" ]; then SAV=$(zenity --file-selection --directory --filename="/home/robz1/"\ --title="Own-Media - >>SELECT DESTINATION<<") if [ "$?" = 1 ]; then exit $?; fi SAV="$SAV""/" # Reset destination, maybe. fi # Copy files to destination. while read N; do cp -u "$N" "$SAV"; done <<< "$FIL" # Take possession of files as destination user, change owner. while read N; do chown "$USE":"$USE" "$SAV""$(basename "$N")"; done <<< "$FIL" sudo -k # Drop superuser privileges. # Rename to standard format i.e. [ Show Name - [01x01] - Episode Name ]. zenity --question --title= --text="Do you wish to rename & achive." if [ "$?" = 1 ]; then exit $? else while read N; do tvnamer --batch "$SAV""$(basename "$N")"; done <<< "$FIL" fi cp -aur "$SAV""." "$ARC" # Copy new files to a backup achive.
File Transfer
#!/bin/bash # Filename: ssh-transfer # Version: 140713 # Author: robz # # This little script automates the transfer of media files from my PC to my XBMC # media centre, which runs on the embedded Openelec operating system installed # on a Raspberry Pi credit-card computer. # First install the rsync utility on your XBMC media centre via "ADD-ONS". # Use this excellent link to setup an ssh key for rsync to login automagicly. # http://www.thegeekstuff.com/2011/07/rsync-over-ssh-without-password/ # Put this script in your "nautilus-scripts" directory select file/s to # transfer then right click and select this script from the Scripts menu. # Don't forget "chmod u+x /home/<user>/.gnome2/nautilus-scripts/ssh-transfer" # to make it executable. # Path to the "rsync" utility on Openelec. RSYNC="/storage/.xbmc/addons/network.backup.rsync/bin/rsync" IPADD="192.168.1.67" # IP address of your Openelec box. OELEC="/media/USBMEDIA/" # Destination directory on XBMC. # Create newline delimited selected files list, handling spaces in file names. FILES=$(echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" |\ awk 'BEGIN { FS = "\n" } { printf "\"%s\" ", $1 }' | sed -e s#\"\"##) # Select destination for file transfer. LOCTN=$(zenity\ --title "SSH File Transfer"\ --height=230\ --text "Transfer Files To XBMC Media Centre."\ --list --radiolist\ --column "Select" --column "Send Files To..."\ TRUE New FALSE TV FALSE Movies FALSE Music FALSE Concerts) if [ "$?" = 1 ]; then exit $?; fi # Cancel/close? then exit script. # File count, how many files. IFS=$(echo -en "\n\b") # Loop handles names with spaces now. for N in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do ((NOFLS+=1)); done # Open a terminal to run rsync and view file transfer progress. gnome-terminal --geometry 70x30+48+0 --title="SSH File Transfer" -x bash -c\ "echo 'Sending $NOFLS files to $OELEC$LOCTN'; echo; tput civis;\ rsync -avP --rsync-path=$RSYNC -e ssh $FILES root@$IPADD:$OELEC$LOCTN;\ tput bold; tput setaf 3; echo;\ echo -e 'Done, hit a key to exit this shell, auto exit in 30s...';\ read -n1 -t30" # Update XBMC ibrary. ssh -l root $IPADD 'xbmc-send --action="XBMC.updatelibrary(video)"' && \ ssh -l root $IPADD 'xbmc-send --action="XBMC.updatelibrary(music)"'