• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Strawberry Music Player Forums
    2. Rolf
    R
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Best 1
    • Controversial 0
    • Groups 0

    Rolf

    @Rolf

    2
    Reputation
    5
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Rolf Unfollow Follow

    Best posts made by Rolf

    • RE: Import ratings from other players esp Clementine

      For those running Linux, here's an experimental, quick-and-dirty bash script that updates a Strawberry database with rating, playcount, skipcount, lastplayed values taken from an existing Clementine database file. Save it e.g. as clementine2strawberry.sh and make it executable.

      Never work on the original database files (~.config/Clementine/clementine.db and ~/.local/share/strawberry/strawberry/strawberry.db) - rather copy both to a working directory and store an additional backup in a safe place.

      Usage of the script, in your working directory:

      /path/to/clementine2strawberry.sh clementine.db strawberry.db
      

      If the update is successful, you can try to replace ~/.local/share/strawberry/strawberry/strawberry.db with its updated version, fire up Strawberry, and see whether your Clementine data has been correctly imported.

      A few technical notes:

      • The fields are simply overwritten with what is found in Clementine's DB - there is, e.g., no summing up of Clementine & Strawberry playcounts.
      • If you're reading this post in the "distant future", chances are that database schemata might have changed and you need to update the script to cope with that.
      • I had expected Clementine's songs.filename and Strawberry's songs.url to match, but oddly, without a TRIM(), they don't. Since a TRIM in the update statement makes that run for ages, I TRIM both columns upfront. That is, both .db files will be changed!
      • To cope with slightly different database schemes, it's necessary to use COALESCE() to supply suitable default values where clementine.db does not contain real values.
      #!/bin/bash
      
      CLEMENTINE_DB="$1"
      STRAWBERRY_DB="$2"
      
      UNIQUE_KEY_CLEMENTINE=filename
      UNIQUE_KEY_STRAWBERRY=url
      
      validate_db() {
          if [[ ! -f "${1}" ]]; then
              echo $2 database file $1 does not exist
              exit 1
          fi
      
          if sqlite3 "$1"  "pragma integrity_check;" > /dev/null
          then
              echo $2 database file $1 integrity check OK.
          else
              echo $2 database file $1 integrity check FAILED.
              exit 1
          fi
      }
      
      echo Validating database existence and integrity...
      validate_db "$CLEMENTINE_DB" "Clementine"
      validate_db "$STRAWBERRY_DB" "Strawberry"
      
      # Columns to transfer, respective sequences must match:
      # (COALESCE Clementine values to conform to Strawberry schema and default values.)
      CLEMENTINE_COLUMNS="COALESCE(rating,-1),COALESCE(playcount,0),COALESCE(skipcount,0),COALESCE(lastplayed,-1)"
      STRAWBERRY_COLUMNS="rating,playcount,skipcount,lastplayed"
      
      
      # Trim unique key columns (rows won't match without):
      sqlite3 "$1" "UPDATE songs SET $UNIQUE_KEY_CLEMENTINE = trim($UNIQUE_KEY_CLEMENTINE);"
      sqlite3 "$2" "UPDATE songs SET $UNIQUE_KEY_STRAWBERRY = trim($UNIQUE_KEY_STRAWBERRY);"
      
      
      echo
      echo Updating database $STRAWBERRY_DB using this SQL statement:
      
      if sqlite3 -echo "$2" "ATTACH '$1' AS clementine; UPDATE main.songs SET ($STRAWBERRY_COLUMNS)=(SELECT $CLEMENTINE_COLUMNS FROM clementine.songs WHERE main.songs.$UNIQUE_KEY_STRAWBERRY=clementine.songs.$UNIQUE_KEY_CLEMENTINE) WHERE EXISTS (SELECT * FROM clementine.songs WHERE main.songs.$UNIQUE_KEY_STRAWBERRY=clementine.songs.$UNIQUE_KEY_CLEMENTINE);"
      then
          echo Database update successful. MAKE A BACKUP OF THE ORIGINAL, before you use the updated one.
      else
          echo Database update FAILED.
      fi
      
      posted in Feature Suggestions
      R
      Rolf

    Latest posts made by Rolf

    • RE: Import ratings from other players esp Clementine

      For those running Linux, here's an experimental, quick-and-dirty bash script that updates a Strawberry database with rating, playcount, skipcount, lastplayed values taken from an existing Clementine database file. Save it e.g. as clementine2strawberry.sh and make it executable.

      Never work on the original database files (~.config/Clementine/clementine.db and ~/.local/share/strawberry/strawberry/strawberry.db) - rather copy both to a working directory and store an additional backup in a safe place.

      Usage of the script, in your working directory:

      /path/to/clementine2strawberry.sh clementine.db strawberry.db
      

      If the update is successful, you can try to replace ~/.local/share/strawberry/strawberry/strawberry.db with its updated version, fire up Strawberry, and see whether your Clementine data has been correctly imported.

      A few technical notes:

      • The fields are simply overwritten with what is found in Clementine's DB - there is, e.g., no summing up of Clementine & Strawberry playcounts.
      • If you're reading this post in the "distant future", chances are that database schemata might have changed and you need to update the script to cope with that.
      • I had expected Clementine's songs.filename and Strawberry's songs.url to match, but oddly, without a TRIM(), they don't. Since a TRIM in the update statement makes that run for ages, I TRIM both columns upfront. That is, both .db files will be changed!
      • To cope with slightly different database schemes, it's necessary to use COALESCE() to supply suitable default values where clementine.db does not contain real values.
      #!/bin/bash
      
      CLEMENTINE_DB="$1"
      STRAWBERRY_DB="$2"
      
      UNIQUE_KEY_CLEMENTINE=filename
      UNIQUE_KEY_STRAWBERRY=url
      
      validate_db() {
          if [[ ! -f "${1}" ]]; then
              echo $2 database file $1 does not exist
              exit 1
          fi
      
          if sqlite3 "$1"  "pragma integrity_check;" > /dev/null
          then
              echo $2 database file $1 integrity check OK.
          else
              echo $2 database file $1 integrity check FAILED.
              exit 1
          fi
      }
      
      echo Validating database existence and integrity...
      validate_db "$CLEMENTINE_DB" "Clementine"
      validate_db "$STRAWBERRY_DB" "Strawberry"
      
      # Columns to transfer, respective sequences must match:
      # (COALESCE Clementine values to conform to Strawberry schema and default values.)
      CLEMENTINE_COLUMNS="COALESCE(rating,-1),COALESCE(playcount,0),COALESCE(skipcount,0),COALESCE(lastplayed,-1)"
      STRAWBERRY_COLUMNS="rating,playcount,skipcount,lastplayed"
      
      
      # Trim unique key columns (rows won't match without):
      sqlite3 "$1" "UPDATE songs SET $UNIQUE_KEY_CLEMENTINE = trim($UNIQUE_KEY_CLEMENTINE);"
      sqlite3 "$2" "UPDATE songs SET $UNIQUE_KEY_STRAWBERRY = trim($UNIQUE_KEY_STRAWBERRY);"
      
      
      echo
      echo Updating database $STRAWBERRY_DB using this SQL statement:
      
      if sqlite3 -echo "$2" "ATTACH '$1' AS clementine; UPDATE main.songs SET ($STRAWBERRY_COLUMNS)=(SELECT $CLEMENTINE_COLUMNS FROM clementine.songs WHERE main.songs.$UNIQUE_KEY_STRAWBERRY=clementine.songs.$UNIQUE_KEY_CLEMENTINE) WHERE EXISTS (SELECT * FROM clementine.songs WHERE main.songs.$UNIQUE_KEY_STRAWBERRY=clementine.songs.$UNIQUE_KEY_CLEMENTINE);"
      then
          echo Database update successful. MAKE A BACKUP OF THE ORIGINAL, before you use the updated one.
      else
          echo Database update FAILED.
      fi
      
      posted in Feature Suggestions
      R
      Rolf
    • RE: 0.8.2 on Kubuntu 20.04: extremely slow scan of large library

      Hi @jonas,

      in the test installation, 2 tag readers were running.

      Anyway, I see your efforts and testing and I don't think we can resolve this issue within a reasonable time frame. I think I'll simply reduce my collection to be scanned by around 50K files that I have mainly for archival purposes; I can manage them elsewhere. With 20K files, Strawberry performs ok, as-is. I'll continue to test and will let you know when the larger collection gets scanned fine.

      BTW: Thank you for the great work on Strawberry, I like the configurability and the easy way of retrieving good quality cover images. So, I keep using it. As I saw on github, somebody else has already posted a wish for multiple genres per file, which seems to imply a lot of rework with respect to the tag reader and the database. It's really the one feature that would make Strawberry perfect for me. Using picard and EasyTag for tagging, I like to keep my collection clean and well-tagged, and I'd love to see the player list all tags separately, in the tree. But that's another story, for another day... 😉

      Greetings,
      Rolf

      posted in Technical Help
      R
      Rolf
    • RE: 0.8.2 on Kubuntu 20.04: extremely slow scan of large library

      Hi @jonas,

      I tried to replicate a similar setup as yours. Purged (including .config & .local files) & re-installed from scratch

      • Clementine 1.3.1 (Ubuntu stock version)
      • Clementine 1.4.0rc1-347-gfc4cb6fc7 (most recent build I could find; I'm using 1.4 RC1 as my standard player)
      • Strawberry 0.8.2 (.deb downloaded straight from www.strawberrymusicplayer.org, as before)

      My audio file collection consist of about 56k mp3s, 16k flacs, and less than 100 .oggs and others, combined.

      I've put the HDD containing the collection into an external enclosure, connected via USB 3.0. Disabled all unnecessary services and background processes. Rebooted before every test run, and even let the HDD cool down, in between tests (verified equal start temperatures, via smartctl).

      A scan from scratch is taking, respectively,

      • 13 minutes with Clementine 1.3.1
      • 32 minutes with Clementine 1.4 RC1 (roughly equal to your scan time, for ~3x the number of files)
      • running since 3h 15 mins, still not finished, with Strawberry 0.8.2

      Since a real HDD is used, a distinctive difference is audible: Clementine 1.3.1 and 1.4 RC1 give the disk heads a "proper workout", i.e. I heard very fast movements. While Strawberry 0.8.2 almost makes them sound as if every single file scan results in a separate head movement, i.e. much lower frequency of head movements.

      Since I haven't changed any part of the hardware and even let the HDDs cool down before the next test run, it seems to me that Clementine and Strawberry must perform the scan differently, somehow. HDD speed does not seem to be a limiting factor here, judged by the other results.

      I'm willing to try any test that you suggest.

      Rolf

      posted in Technical Help
      R
      Rolf
    • 0.8.2 on Kubuntu 20.04: extremely slow scan of large library

      Hello,

      I'm encountering extremely slow scans by Strawberry 0.8.2 of my library (72K audio files) under Kubuntu 20.04. The machine should be sufficient: 8 × Intel Core i5-10210U CPU @ 1.60GHz, 32GB RAM. It takes nearly a whole day to build the database from scratch, and I can watch the process slowing down in the course of the day, on the console.

      What I've tried, so far:

      • tested scanning from a remote NAS vs. from local files: no significant scan speed difference, similar slowdown
      • tested Clementine, in comparison, on both remote NAS vs. local files: finishes scan from scratch within 1-2 hours

      What I've noticed:

      • I don't know the source code, so I don't know whether I could speed up the scanning by having Strawberry place any "intermediate files" on a RAM disk (~/.local/share/strawberry/strawberry/strawberry.db has a size of about 290KB at the start of a full scan, and it does not grow until the end of the scanning process; after the scan has finished, its size is around 64MB)
      • Updating the database, a day or more later, almost never completes within a day; Clementine takes about 2 minutes, in comparison

      I'm running out of ideas what might go wrong or what else I could try?
      Rolf

      posted in Technical Help
      R
      Rolf