|
Best Porn Sites | Live Sex | Register | FAQ | Members List | Calendar | Mark Forums Read |
|
Thread Tools | Display Modes |
June 17th, 2017, 05:34 AM | #1 |
Senior Member
Join Date: Aug 2011
Posts: 333
Thanks: 1,098
Thanked 8,548 Times in 339 Posts
|
pixhost.org BASH upload script
If you are familiar with BASH scripts, thought I'd post this in case someone wanted to modify it for their needs.
READ THE WARNING IN THE SCRIPT COMMENTS OR YOU'LL SCREW THIS UP. - BBCODE won't let me post it as-is. Code:
#!/bin/bash #Fix sequence for missing images (404 not found) #Rename 0001, 0002, 0003... #Delete this if you want to keep filenames a=1 for i in *.[Jj][Pp][Gg]; do new=$(printf "%04d.jpg" "$a") #04 pad to length of 4 mv -i -- "$i" "$new" let a=a+1 done #Find all JPG files in current folder files=($(find -E . -type f -regex "^.*jpg")) #Clear the Forum URL txt file if it exists. > post.txt #Process each JPG Found for item in ${files[*]} do printf " %s\n" $item | sed 's/\ \ \ .\///g' output=$(curl -X POST --include "https://api.pixhost.to/images" -H 'Content-Type: multipart/form-data; charset=utf-8' -H 'Accept: application/json' -F "img=@$item" -F 'content_type=0' -F 'max_th_size=180') fullImage=$(echo $output | sed 's/^.*show_url//g' | sed 's/\":\"//g' | sed 's/\\//g' | sed 's/\".*//g') thumbImage=$(echo $output | sed 's/^.*show_url//g' | sed 's/\":\"//g' | sed 's/\\//g' | sed 's/^.*th_url//g' | sed 's/"}//g') # WARNING: CHANGE below { to [ and } to ]...bbcode makes this a URL so it won't post right on forum. echo -n "{url="$fullImage"][img]"$thumbImage"[/img][/url} " >> post.txt done #Put into OSX Clipboard cat post.txt | sort | pbcopy #Send OSX Notification osascript -e 'display notification "Copied to Clipboard" with title "Upload Complete"' #Delete all JPGs in folder to clear for next batch. rm *.jpg Feel free to tweak and repost a better version that is more adaptable to all. Just sharing in case it helps someone get started on their own script. If you don't know what you're doing—Don't. You've been warned. Here it is in action. https://www.youtube.com/watch?v=T4-anPkVvfg |
|
Thread Tools | |
Display Modes | |
|
|