Compare commits
No commits in common. "b6110cf626b873574a79b4968bf366dd0a3ab0d8" and "ce1ff7aff5d9d9b904b76915ac6ca24e01a554b2" have entirely different histories.
b6110cf626
...
ce1ff7aff5
35
atom
35
atom
@ -214,13 +214,9 @@ read -u4 removecount
|
|||||||
until (( ${#removefile[@]} == removecount ))
|
until (( ${#removefile[@]} == removecount ))
|
||||||
do
|
do
|
||||||
echo '
|
echo '
|
||||||
SELECT destination_files.id,
|
SELECT id,
|
||||||
destinations.name,
|
filename
|
||||||
destination_files.filename
|
|
||||||
FROM destination_files
|
FROM destination_files
|
||||||
INNER JOIN destinations
|
|
||||||
ON destination_files.destination_id
|
|
||||||
= destinations.id
|
|
||||||
WHERE source_file_id is NULL
|
WHERE source_file_id is NULL
|
||||||
LIMIT 500 OFFSET '${#removefile[@]}';
|
LIMIT 500 OFFSET '${#removefile[@]}';
|
||||||
|
|
||||||
@ -230,11 +226,7 @@ do
|
|||||||
read -u4 line
|
read -u4 line
|
||||||
until [[ $line == AtOM:NoMoreFiles ]]
|
until [[ $line == AtOM:NoMoreFiles ]]
|
||||||
do
|
do
|
||||||
removeFileId=${line%%::AtOM:SQL:Sep::*}
|
removefile[${line%::AtOM:SQL:Sep::*}]="${line#*::AtOM:SQL:Sep::}"
|
||||||
rest=${line#*::AtOM:SQL:Sep::}
|
|
||||||
removeFileDestName=${line%%::AtOM:SQL:Sep::*}
|
|
||||||
rest=${line#*::AtOM:SQL:Sep::}
|
|
||||||
removefile[$removeFileId]="${destinationpath["$removeFileDestName"]}/${rest%%::AtOM:SQL:Sep::*}"
|
|
||||||
read -u4 line
|
read -u4 line
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@ -296,7 +288,6 @@ echo '
|
|||||||
ascii INTEGER,
|
ascii INTEGER,
|
||||||
source_file INTEGER,
|
source_file INTEGER,
|
||||||
fileid INTEGER,
|
fileid INTEGER,
|
||||||
destdir TEXT,
|
|
||||||
filename TEXT,
|
filename TEXT,
|
||||||
cmd_arg0 TEXT,
|
cmd_arg0 TEXT,
|
||||||
cmd_arg1 TEXT,
|
cmd_arg1 TEXT,
|
||||||
@ -903,9 +894,7 @@ do
|
|||||||
progressSpin
|
progressSpin
|
||||||
if [[ "$oldfilename" != "$destfilename" ]]
|
if [[ "$oldfilename" != "$destfilename" ]]
|
||||||
then
|
then
|
||||||
mv \
|
mv "$oldfilename" "$destfilename"
|
||||||
"${destinationpath[$destination]}/$oldfilename" \
|
|
||||||
"${destinationpath[$destination]}/$destfilename"
|
|
||||||
(( changedcount++ ))
|
(( changedcount++ ))
|
||||||
commit=1
|
commit=1
|
||||||
fi
|
fi
|
||||||
@ -940,14 +929,10 @@ done
|
|||||||
copyFiles_action
|
copyFiles_action
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
SELECT destination_files.id,
|
SELECT id,
|
||||||
destination_files.filename,
|
filename,
|
||||||
destination_files.old_filename,
|
old_filename
|
||||||
destinations.name
|
|
||||||
FROM destination_files
|
FROM destination_files
|
||||||
INNER JOIN destinations
|
|
||||||
ON destination_files.destination_id
|
|
||||||
= destinations.id
|
|
||||||
WHERE old_filename IS NOT NULL;
|
WHERE old_filename IS NOT NULL;
|
||||||
|
|
||||||
SELECT "AtOM:NoMoreFiles";
|
SELECT "AtOM:NoMoreFiles";
|
||||||
@ -967,12 +952,10 @@ do
|
|||||||
id=${line%%::AtOM:SQL:Sep::*}
|
id=${line%%::AtOM:SQL:Sep::*}
|
||||||
rest=${line#*::AtOM:SQL:Sep::}
|
rest=${line#*::AtOM:SQL:Sep::}
|
||||||
filename=${rest%%::AtOM:SQL:Sep::*}
|
filename=${rest%%::AtOM:SQL:Sep::*}
|
||||||
rest=${line#*::AtOM:SQL:Sep::}
|
oldfilename=${rest#*::AtOM:SQL:Sep::}
|
||||||
oldfilename=${rest%%::AtOM:SQL:Sep::*}
|
|
||||||
destination=${rest#*::AtOM:SQL:Sep::}
|
|
||||||
if [[ $oldfilename != "$filename" ]] && [ -f "$oldfilename" ]
|
if [[ $oldfilename != "$filename" ]] && [ -f "$oldfilename" ]
|
||||||
then
|
then
|
||||||
rm -f "${destinationpath[$destination]}/$oldfilename"
|
rm -f "$oldfilename"
|
||||||
fi
|
fi
|
||||||
Update destination_files old_filename NULL <<<"id = $id"
|
Update destination_files old_filename NULL <<<"id = $id"
|
||||||
(( count++ ))
|
(( count++ ))
|
||||||
|
|||||||
@ -5,7 +5,7 @@ getConfigDestination() {
|
|||||||
destinationenabled["$destination"]="$value"
|
destinationenabled["$destination"]="$value"
|
||||||
;;
|
;;
|
||||||
'path')
|
'path')
|
||||||
destinationpath["$destination"]="${value%/}"
|
destinationpath["$destination"]="$value"
|
||||||
;;
|
;;
|
||||||
'format')
|
'format')
|
||||||
case "$value" in
|
case "$value" in
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
currentdbversion=7
|
currentdbversion=6
|
||||||
checkDatabaseVersion() {
|
checkDatabaseVersion() {
|
||||||
local dbversion
|
local dbversion
|
||||||
if dbversion=$(Select atom version <<<"\"1\" = 1")
|
if dbversion=$(Select atom version <<<"\"1\" = 1")
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
upgradedatabase_6_7() {
|
|
||||||
echo "Upgrading database to version 7... (backup is $database.bak_v6)"
|
|
||||||
cp "$database" "$database.bak_v6"
|
|
||||||
for destination in "${destinations[@]}"
|
|
||||||
do
|
|
||||||
echo "UPDATE destination_files SET filename = REPLACE(filename,'${destinationpath[$destination]}/','') WHERE filename LIKE '${destinationpath[$destination]}/%';" >&3
|
|
||||||
done
|
|
||||||
Update atom version 7 <<<"1 = 1"
|
|
||||||
}
|
|
||||||
@ -53,7 +53,7 @@ encodeFile::mp3() {
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
lameopts+=("$tempdir/$tmpfile.wav" "${destinationpath[$destination]}/$destdir/$destfile.mp3")
|
lameopts+=("$tempdir/$tmpfile.wav" "$destdir/$destfile.mp3")
|
||||||
encodetaskid=$(
|
encodetaskid=$(
|
||||||
Insert tasks <<-EOInsert
|
Insert tasks <<-EOInsert
|
||||||
key ${fileid}lame$destination
|
key ${fileid}lame$destination
|
||||||
|
|||||||
@ -23,7 +23,7 @@ encodeFile::opus() {
|
|||||||
[ -n "$track" ] && opusencopts+=(--comment "TRACKNUMBER=${track%/*}")
|
[ -n "$track" ] && opusencopts+=(--comment "TRACKNUMBER=${track%/*}")
|
||||||
[ -n "${track#*/}" ] && opusencopts+=(--comment "TRACKTOTAL=${track#*/}")
|
[ -n "${track#*/}" ] && opusencopts+=(--comment "TRACKTOTAL=${track#*/}")
|
||||||
[ -n "$year" ] && opusencopts+=(--comment "DATE=$year")
|
[ -n "$year" ] && opusencopts+=(--comment "DATE=$year")
|
||||||
opusencopts+=("$tempdir/$tmpfile".wav "${destinationpath[$destination]}/$destdir/$destfile.opus")
|
opusencopts+=("$tempdir/$tmpfile".wav "$destdir/$destfile.opus")
|
||||||
encodetaskid=$(
|
encodetaskid=$(
|
||||||
Insert tasks <<-EOInsert
|
Insert tasks <<-EOInsert
|
||||||
key ${fileid}opusenc$destination
|
key ${fileid}opusenc$destination
|
||||||
|
|||||||
@ -17,7 +17,7 @@ encodeFile::vorbis() {
|
|||||||
[ -n "$title" ] && oggencopts+=(-t "$title")
|
[ -n "$title" ] && oggencopts+=(-t "$title")
|
||||||
[ -n "$track" ] && oggencopts+=(-N "$track")
|
[ -n "$track" ] && oggencopts+=(-N "$track")
|
||||||
[ -n "$year" ] && oggencopts+=(-d "$year")
|
[ -n "$year" ] && oggencopts+=(-d "$year")
|
||||||
oggencopts+=(-o "${destinationpath[$destination]}/$destdir/$destfile.ogg" "$tempdir/$tmpfile.wav")
|
oggencopts+=(-o "$destdir/$destfile.ogg" "$tempdir/$tmpfile.wav")
|
||||||
encodetaskid=$(
|
encodetaskid=$(
|
||||||
Insert tasks <<-EOInsert
|
Insert tasks <<-EOInsert
|
||||||
key ${fileid}oggenc$destination
|
key ${fileid}oggenc$destination
|
||||||
|
|||||||
@ -41,7 +41,7 @@ getDestDir() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
then
|
then
|
||||||
destdir=""
|
destdir="${destinationpath[$destination]}/"
|
||||||
if (( ${destinationascii["$destination"]} ))
|
if (( ${destinationascii["$destination"]} ))
|
||||||
then
|
then
|
||||||
echo "$album" >&${toascii[1]}
|
echo "$album" >&${toascii[1]}
|
||||||
@ -83,7 +83,8 @@ getDestDir() {
|
|||||||
replace=$(sanitizeFile "$disc" dir)
|
replace=$(sanitizeFile "$disc" dir)
|
||||||
destdir="${destdir//?(\[)%\{disc\}?(\])/$replace}"
|
destdir="${destdir//?(\[)%\{disc\}?(\])/$replace}"
|
||||||
else
|
else
|
||||||
destdir=$(sanitizeFile "${filename%%/*}" dir)
|
destdir="${destinationpath[$destination]}/"
|
||||||
|
destdir+=$(sanitizeFile "${filename%%/*}" dir)
|
||||||
part=${filename#*/}
|
part=${filename#*/}
|
||||||
while [[ $part =~ / ]]
|
while [[ $part =~ / ]]
|
||||||
do
|
do
|
||||||
@ -100,7 +101,7 @@ getDestDir() {
|
|||||||
fi
|
fi
|
||||||
if ! [ -d "$destdir" ]
|
if ! [ -d "$destdir" ]
|
||||||
then
|
then
|
||||||
mkdir -p "${destinationpath[$destination]}/$destdir"
|
mkdir -p "$destdir"
|
||||||
fi
|
fi
|
||||||
destdir="${destdir//+(\/)//}"
|
destdir="${destdir//+(\/)//}"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
getTags_version='unknown-4'
|
getTags_version='unknown-4'
|
||||||
getTags() {
|
getTags() {
|
||||||
local type
|
unset type
|
||||||
case "$mimetype" in
|
case "$mimetype" in
|
||||||
audio/mpeg)
|
audio/mpeg)
|
||||||
type=ffmpeg
|
type=ffmpeg
|
||||||
|
|||||||
@ -1,13 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
cat <<-EOWarn
|
|
||||||
This script is unmaintained and provided as-is. It may or may not work.
|
|
||||||
|
|
||||||
Use at your own risk!
|
|
||||||
EOWarn
|
|
||||||
|
|
||||||
read -p "Press Enter to continue or Ctrl-C to abort"
|
|
||||||
|
|
||||||
# config structures
|
# config structures
|
||||||
declare -A \
|
declare -A \
|
||||||
destinationchannels \
|
destinationchannels \
|
||||||
|
|||||||
@ -62,42 +62,27 @@ getConfig
|
|||||||
sanityCheck
|
sanityCheck
|
||||||
openDatabase
|
openDatabase
|
||||||
|
|
||||||
echo '
|
echo 'SELECT id,filename FROM destination_files WHERE filename IS NOT NULL;' >&3
|
||||||
SELECT
|
|
||||||
destination_files.id,
|
|
||||||
destinations.name,
|
|
||||||
destination_files.filename
|
|
||||||
FROM destinations
|
|
||||||
INNER JOIN destination_files
|
|
||||||
ON destinations.id=destination_files.destination_id
|
|
||||||
WHERE filename IS NOT NULL;' >&3
|
|
||||||
echo 'SELECT "AtOM:NoMoreFiles";' >&3
|
echo 'SELECT "AtOM:NoMoreFiles";' >&3
|
||||||
|
|
||||||
declare -a \
|
read -u4 filename
|
||||||
destination_names \
|
until [[ $filename == AtOM:NoMoreFiles ]]
|
||||||
files
|
|
||||||
read -u4 line
|
|
||||||
until [[ $line == AtOM:NoMoreFiles ]]
|
|
||||||
do
|
do
|
||||||
id=${line%%::AtOM:SQL:Sep::*}
|
files+=("$filename")
|
||||||
rest=${line#*::AtOM:SQL:Sep::}
|
read -u4 filename
|
||||||
destination_names[id]=${rest%%::AtOM:SQL:Sep::*}
|
|
||||||
rest=${rest#*::AtOM:SQL:Sep::}
|
|
||||||
files[id]=${rest}
|
|
||||||
read -u4 line
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo 'BEGIN TRANSACTION;' >&3
|
echo 'BEGIN TRANSACTION;' >&3
|
||||||
|
|
||||||
echo -n "Checking for missing files... "
|
echo -n "Checking for missing files... "
|
||||||
for index in "${!files[@]}"
|
for filename in "${files[@]}"
|
||||||
do
|
do
|
||||||
destination=${destination_names[index]}
|
id=${filename%%::AtOM:SQL:Sep::*}
|
||||||
filename="${destinationpath[$destination]}/${files[index]}"
|
filename=${filename#*::AtOM:SQL:Sep::}
|
||||||
if ! [ -f "$filename" ]
|
if ! [ -f "$filename" ]
|
||||||
then
|
then
|
||||||
echo -e "\r$filename\033[K"
|
echo -e "\r$filename\033[K"
|
||||||
((regen))&&Update destination_files last_change 0 <<<"id = $index"
|
((regen))&&Update destination_files last_change 0 <<<"id = $id"
|
||||||
echo -n "Checking for missing files... "
|
echo -n "Checking for missing files... "
|
||||||
(( missing++ ))
|
(( missing++ ))
|
||||||
fi
|
fi
|
||||||
@ -106,6 +91,6 @@ done
|
|||||||
|
|
||||||
echo 'COMMIT;' >&3
|
echo 'COMMIT;' >&3
|
||||||
|
|
||||||
echo -e "\r${missing:-No} missing files\033[K"
|
echo -e "\r${missing:-0} missing files\033[K"
|
||||||
|
|
||||||
closeDatabase
|
closeDatabase
|
||||||
|
|||||||
@ -73,7 +73,7 @@ do
|
|||||||
do
|
do
|
||||||
if ! Select destination_files id \
|
if ! Select destination_files id \
|
||||||
>/dev/null \
|
>/dev/null \
|
||||||
<<<"filename = ${filename#${destinationpath["$destination"]}/}"
|
<<<"filename = $filename"
|
||||||
then
|
then
|
||||||
echo -e $'\r'"$filename\033[K"
|
echo -e $'\r'"$filename\033[K"
|
||||||
(( remove )) && rm -f "$filename"
|
(( remove )) && rm -f "$filename"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user