diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 index 1b9cce1..154b2ec --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ As you can see, the vast majority of my scripts are used to handle my [Friendica * friendica-find-largest-accounts.sh: Finds which are the contacts that have the most posts assigned to them. * friendica-delete-specific-contact.sh: Uses the same code as the previous scripts to delete all data from a specific user, particularly useful for unfollowed contacts with too many posts. * media-optimize-local.sh: For a given folder, it finds any image files within and compresses them. Requires `gifsicle`, `oxipng`, `jpegoptim`, and `cwebp` installed. -* youtube-download-channel.sh: A wrapper to ease downloading metadata from subscriptions or channels, in order to export it as a CSV, and as a playlist DB file compatible with FreeTube. Requires `yt-dlp`, and optionally a cookie to download your subscriptions. +* youtube-download-channel.sh: A wrapper to ease downloading metadata from subscriptions or channels, in order to export it as a CSV, and as a playlist DB file compatible with FreeTube. Requires `yt-dlp`, `jq`, and optionally a cookie to download your subscriptions. # License diff --git a/copy.sh b/copy.sh old mode 100755 new mode 100644 diff --git a/friendica-clean-database.sh b/friendica-clean-database.sh old mode 100755 new mode 100644 diff --git a/friendica-compress-storage.sh b/friendica-compress-storage.sh old mode 100755 new mode 100644 diff --git a/friendica-delete-non-follower-featured-posts.sh b/friendica-delete-non-follower-featured-posts.sh old mode 100755 new mode 100644 diff --git a/friendica-delete-old-users.sh b/friendica-delete-old-users.sh old mode 100755 new mode 100644 index bf1ee71..16c3763 --- a/friendica-delete-old-users.sh +++ b/friendica-delete-old-users.sh @@ -112,12 +112,19 @@ if [[ -n $(type curl) && -n "${dbengine}" && -n $(type "${dbengine}") && -n $(ty echo "0 0 0 0 0 0 0 0 0 0 0 0" >"${tmpfile}" if [[ "${intense_optimizations}" -gt 0 ]]; then "${dbengine}" "${db}" -v -e "\ - alter table \`contact\` add index if not exists \`tmp_contact_baseurl\` (baseurl); \ + alter table \`contact\` add index if not exists \`tmp_contact_baseurl_addr\` (baseurl, addr); \ alter table \`post-thread\` add index if not exists \`tmp_post_thread_id\` (\`owner-id\`, \`author-id\`, \`causer-id\`); \ alter table \`post-thread-user\` add index if not exists \`tmp_post_thread_user_id\` (\`owner-id\`, \`author-id\`, \`causer-id\`); \ alter table \`post-user\` add index if not exists \`tmp_post_user_id\` (\`owner-id\`, \`author-id\`, \`causer-id\`); \ alter table \`post\` add index if not exists \`tmp_post_id\` (\`owner-id\`, \`author-id\`, \`causer-id\`); \ alter table \`photo\` add index if not exists \`tmp_photo_id\` (\`contact-id\`); \ + select count(\`id\`) from contact c where \ + c.\`addr\` not in (select \`addr\` from \`contact\` where \`id\` in (select \`cid\` from \`user-contact\`)) and \ + c.\`addr\` not in (select \`addr\` from \`contact\` where \`id\` in (select \`uid\` from \`user\`)) and \ + c.\`addr\` not in (select \`addr\` from \`contact\` where \`id\` in (select \`contact-id\` from \`group_member\`)) and \ + c.\`contact-type\` != 4 and not pending and \`last-item\` < CURDATE() - INTERVAL ${period} and \ + c.\`nick\` not in ('threads.sys', 'relay', 'friendica', 'sharkey', 'bot', 'catodon', \ + 'flipboard', 'lemmy', 'mitra', 'mstdn_bot', 'peertube', 'piefed', 'admin'); " fi counter=0 @@ -133,9 +140,9 @@ if [[ -n $(type curl) && -n "${dbengine}" && -n $(type "${dbengine}") && -n $(ty fi done < <("${dbengine}" "${db}" -N -B -q -e \ "select \`id\`, \`nick\`, \`baseurl\`, \`last-item\` from contact c where \ - c.\`id\` not in (select \`cid\` from \`user-contact\`) and \ - c.\`id\` not in (select \`uid\` from \`user\`) and \ - c.\`id\` not in ( select \`contact-id\` from \`group_member\`) and \ + c.\`addr\` not in (select \`addr\` from \`contact\` where \`id\` in (select \`cid\` from \`user-contact\`)) and \ + c.\`addr\` not in (select \`addr\` from \`contact\` where \`id\` in (select \`uid\` from \`user\`)) and \ + c.\`addr\` not in (select \`addr\` from \`contact\` where \`id\` in (select \`contact-id\` from \`group_member\`)) and \ c.\`contact-type\` != 4 and not pending and \`last-item\` < CURDATE() - INTERVAL ${period} and \ c.\`nick\` not in ('threads.sys', 'relay', 'friendica', 'sharkey', 'bot', 'catodon', \ 'flipboard', 'lemmy', 'mitra', 'mstdn_bot', 'peertube', 'piefed', 'admin') \ @@ -156,7 +163,7 @@ if [[ -n $(type curl) && -n "${dbengine}" && -n $(type "${dbengine}") && -n $(ty alter table \`post\` auto_increment = 1; \ alter table \`photo\` auto_increment = 1; \ alter table \`contact\` auto_increment = 1; \ - alter table \`contact\` drop index \`tmp_contact_baseurl\`; \ + alter table \`contact\` drop index \`tmp_contact_baseurl_addr\`; \ alter table \`post-thread\` drop index \`tmp_post_thread_id\`; \ alter table \`post-thread-user\` drop index \`tmp_post_thread_user_id\`; \ alter table \`post-user\` drop index \`tmp_post_user_id\`; \ diff --git a/friendica-delete-specific-contact.sh b/friendica-delete-specific-contact.sh old mode 100755 new mode 100644 diff --git a/friendica-find-largest-accounts.sh b/friendica-find-largest-accounts.sh old mode 100755 new mode 100644 diff --git a/friendica-find-missing-servers.sh b/friendica-find-missing-servers.sh old mode 100755 new mode 100644 diff --git a/friendica-fix-avatar-permissions.sh b/friendica-fix-avatar-permissions.sh old mode 100755 new mode 100644 diff --git a/friendica-remove-invalid-photos.sh b/friendica-remove-invalid-photos.sh old mode 100755 new mode 100644 diff --git a/friendica-remove-old-photos-parallel.sh b/friendica-remove-old-photos-parallel.sh old mode 100755 new mode 100644 index 7a49b8b..9223d36 --- a/friendica-remove-old-photos-parallel.sh +++ b/friendica-remove-old-photos-parallel.sh @@ -54,7 +54,7 @@ while read -r x; do while read -r y; do m=$((m + 1)) loop "${x}" "${m}" "${n}" "${d}" "${y}" #& - done < <(find "${x}" -type f -iname "*-48*") + done < <(find "${x}" -type f \( -iname "*-48*" -or -iname "*-80*" -or -iname "*-320*" \)) fi if [[ "${intense_optimizations}" -eq 1 ]]; then printf "\rFolder %d\tDone " "${n}" diff --git a/friendica-workerqueue.sh b/friendica-workerqueue.sh old mode 100755 new mode 100644 diff --git a/media-optimize-local.sh b/media-optimize-local.sh old mode 100755 new mode 100644 diff --git a/youtube-download-channel.sh b/youtube-download-channel.sh old mode 100755 new mode 100644 index 0a8ffe8..af190c2 --- a/youtube-download-channel.sh +++ b/youtube-download-channel.sh @@ -27,7 +27,7 @@ archive="${subfolder}/${channel}.txt" sortcsv="${temporary}/${channel}-sort.csv" csv="${subfolder}/${channel}.csv" json="${subfolder}/${channel}.db" -python="python" +python="python3" if [[ -f "/opt/venv/bin/python" ]]; then python="/opt/venv/bin/python" fi @@ -141,7 +141,7 @@ find "${temporary}" -type f -iname "*.info.json" | while read -r x; do fi echo "youtube $(jq -cr '.id' "${x}")" >>"${temporary}/${channel}.txt" if [[ ${enablecsv} = "1" ]]; then - jq -c '[.upload_date, .timestamp, .uploader , .title, .webpage_url]' "${x}" | while read -r i; do + jq -c '[.upload_date, .timestamp, .duration, .uploader , .title, .webpage_url]' "${x}" | while read -r i; do echo "${i}" | sed -e "s/^\[//g" -e "s/\]$//g" -e "s/\\\\\"/"/g" >>"${csv}" done fi @@ -184,7 +184,7 @@ if [[ ${enabledb} = "1" ]]; then fi if [[ ${enablecsv} = "1" ]]; then sort "${csv}" | uniq >"${temporary}/${channel}-without-header.csv" - echo '"Upload Date", "Timestamp", "Uploader", "Title", "Webpage URL"' >"${temporary}/${channel}.csv" + echo '"Upload Date", "Timestamp", "Duration", "Uploader", "Title", "Webpage URL"' >"${temporary}/${channel}.csv" cat "${temporary}/${channel}-without-header.csv" >>"${temporary}/${channel}.csv" mv "${temporary}/${channel}.csv" "${csv}" rm "${temporary}/${channel}-without-header.csv"