Files
dotfiles/scripts/shell/gdl-create-url-txt-twitter.sh
Matheus Albino e142259896 Some updates
2024-07-02 21:31:48 -03:00

51 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
cur_dirname=`pwd`
if [[ $cur_dirname != *"gallery-dl/twitter" ]]; then
echo 'Not a valid path'
echo 'Are you inside a gallery-dl/twitter directory?'
exit 1
fi
# creates a .txt file for each .png file
if false; then
files=($(find * -type f -not -name '*.txt'))
for f in ${files[@]}; do
filenameSplit=(${f//\// })
account_name=${filenameSplit[0]}
file_name=${filenameSplit[1]}
post_id=`echo $file_name | cut -f1 -d"_"`
tweet_url="https://twitter.com/$account_name/status/$post_id"
echo $tweet_url > $account_name/$post_id.txt
done
fi
# creates a .txt file for each artist folder
if true; then
artists=($(find * -type d))
for account_name in ${artists[@]}; do
echo "Doing \"$account_name\" now..."
files=($(find $account_name -type f -not -name '*.txt'))
urls_filename="$account_name/urls.txt"
rm --force $urls_filename
for f in ${files[@]}; do
filenameSplit=(${f//\// })
file_name=${filenameSplit[1]}
post_id=`echo $file_name | cut -f1 -d"_"`
tweet_url="https://twitter.com/$account_name/status/$post_id"
echo "$file_name: $tweet_url" >> $urls_filename
done
done
fi