How to locate the folder of the track being played from USB drive?

I think sqlite3 will be installed by default on Ubuntu:
Code:
sqlite3 -header -tabs files.db "select path, title, duration, bitrate, samplerate, creator, album, channels, disc, track, date, mime from details where mime not null;" > ~/tracks.txt

Although if @vbutani wants to go down this route it may be easier to perform the dedupe in sql.
This query works fine, checking tracks csv.

1745603522079.png
 
This query works fine, checking tracks csv.
Did you try:
Code:
select *
  from (
         select artist||' - '||regexp_replace(album, ' \(.*\)', '') as artist_album,
                regexp_replace(path, '(?i)\/(CD|DISC) *\d*', '') as path,
                sum(1) over (partition by artist||' - '||regexp_replace(album, ' \(.*\)', '')) as count_albums
           from (
                  select distinct artist,
                         album,
                         rtrim(path, replace(path, '/', '')) as path
                    from details
                    where mime not null
                )
           group by 1, 2
       )
where count_albums > 1;

EDIT: Updated to strip (xyz) from album and CD/Disc folders from paths to help with match.
This does require a regex extension to be loaded.
Code:
sqlite> .load ./regexp

I can put some basic instructions together if you don't know how to load the regex extension.

EDIT: I'll change it so it's a cli call like the other extract.
 
The following code performs matching on lowercase albumartist and album (stripped of anything in parenthesis) and strips any trailing folders called CDXX or DiscXX from paths to avoid false positives.

Bash:
# Create a temporary directory and change into it
mkdir temp && cd $_

# download the regex extension and unzip
wget "https://github.com/nalgeon/sqlean/releases/download/0.27.1/sqlean-linux-x86.zip"
unzip sqlean-linux-x86.zip

#####  copy the files.db into this directory ######

# run the following code to produce matches.txt
sqlite3 -header -tabs files.db ".load ./regexp" "select *
  from (
         select artist||' - '||regexp_replace(album, ' \(.*\)', '') as artist_album,
                regexp_replace(path, '(?i)\/(CD|DISC) *\d*', '') as path,
                sum(1) over (partition by artist||' - '||regexp_replace(album, ' \(.*\)', '')) as count_albums
           from (
                  select distinct lower(artist) as artist,
                         lower(album) as album,
                         rtrim(path, replace(path, '/', '')) as path
                    from details
                    where mime not null
                )
           group by 1, 2
       )
where count_albums > 1" > matches.txt

It's obviously a pretty crude match but it might save you some time.
 
Back
Top