Comments (18)
What has worked for me at the moment is this (make a backup of the DB first of course):
sqlite3 ~/.beets.db "UPDATE items SET path = replace(path, '/mnt/old_folder', '/mnt/new_folder');"
from beets.
Also interested in this, was surprised to find out this wasn't the default.
from beets.
While it's simple (if you understand SQL) you can change your path like this:
update items set path = '/Newpath' || substr(path, <startposition>) where path like '/Oldpath%'
if opening your library file with the CLI sqlite3
(or other sqlite client).
Also for the artpath: update albums set artpath = '/Newpath' || substr(artpath, <startposition>) where artpath like '/Oldpath%'
.
First check, if what you're updating to is what you intended: select path, '/Newpath' || substr(path, <startposition>) from items where path like '/Oldpath%'
.
The percent sign (%) acts like an asterisk (*) in the file system. Unfortunately, this is only a one-time task. Or you need to run it every time before you execute beets with a different path configuration.
But it would really be great to have relative paths stored.
from beets.
This would be great, I use syncthing to share music between 4 devices, each with a different directory
. It would be nice to be able to share the config and library database.
from beets.
I think I used a docker container one time to have a "relative path", when organizing the music on a external usb drive, on two computers. The idea was having a layer between the beets and the data.
For example, on Windows, the path was /music = D:\music
, but on Linux was /music = /mnt/music
from beets.
What has worked for me at the moment is this (make a backup of the DB first of course):
sqlite3 ~/.beets.db "UPDATE items SET path = replace(path, '/mnt/old_folder', '/mnt/new_folder');"
If your albums also point to externally stored cover art you can update these with
sqlite3 ~/.beets.db "UPDATE albums SET artpath = replace(artpath, '/mnt/old_folder', '/mnt/new_folder');"
from beets.
I'm also very interested in relative paths. I have my library on a NAS and share it across several computers; while the path is the same on all computers, it differs from the path on the NAS. Ideally I would use only one beets installation on the NAS, but it has an old ppc cpu, so it's not ideal to compute replaygain info. Also getting gstreamer to compile on it is quite an ordeal.
from beets.
I also like beets to store relative path in the database (starting from the library path from the config file). I had to relocate my Music directory sevral times and I haven't found a good way to do this yet as the full path are stored.
As a side effect, it would also probably reduce the size of the database a bit and make network-shared library easier.
from beets.
+1
from beets.
Also interested in this. I recently had to dismantle my NAS, and add its hard drive (with the beets library) on my computer, ie on a different path. I had to import it all again.
Looking back, I should have done a beet move
before switching the hard drives, but I had assumed only relative paths were used, since beets knows the library path.
from beets.
@sampsyo : what's your opinion here?
from beets.
Relative paths would probably be good idea. The problem is that this would be a deceptively large change -- path handling is extremely pervasive in beets, so the changes would not be localized. It's possible the transition would be easier if we did #1409 (pathlib) first.
from beets.
Just ran into this issue after moving to a new computer. Ran beet update
and proceeded to have my library database completely wiped as everything was removed. This would be a very welcome change that would make libraries much more portable.
from beets.
Really surprised to find out that relative paths aren't supported, now as I stumbled at this portability issue myself.
from beets.
Since I first noticed about this a few years back I just put all my music at "/media/music/library". Its kind of a pain, but I think switching to relative paths could be quite difficult :/
from beets.
Another possibility might be a second directory
config option (let's say server_directory
) that is the remote path that maps to the local path (for example local directory might be /mnt/music
and the remote or server directory /home/myuser/Music
). The DB could still store the path where the files ultimately reside, but could translate that for using beets on a "client" where the DB is on a server. Not sure if that's more or less painful than changing to storing relative paths though 😋 .
from beets.
Is there any recommended way on how to have the music and the library stored in the NAS?
For now, I am will try to store the music in the NAS and having the db
file in my machine.
Edit: I think I was able to have the db
on the NAS well, however I think it is only manageable as long as the absolute path matches. It works in my case as I only manage my music in a single machine.
Edit 2: db
file in the NAS leads to intermetient lock issues.
from beets.
While changing the database does work, it's not a great solution for synchronizing a library between machines, especially when they have different OSes or usernames.
I hacked together a fix by modifying the beets.library.PathType
type to transparently store paths as relative when storing in the database and reversing when taking it out of the database. Unfortunately, the beets util path handling code looks fairly fragile so I suspect there are edge cases where this won't work right.
I would be a lot more confident in code working if we were using pathlib for paths, instead of handing around bytes and strings.
(my "quick hack", probably buggy: artemist@a53fe00)
from beets.
Related Issues (20)
- Beet edit doesn't show custom tags
- Remove 'slow sort' by performing all sorting in SQL only
- Remove the need for additional queries in template variables resolution
- Add a benchmark command to poe
- beet move crashes my laptop and breaks my external memory HOT 2
- Error when loading `convert` plugin HOT 5
- Consider making the `rich-tables` dependency optional
- Itunes ignores albumartist_sort
- Regression in 2.0.0: import UI is useless in ligth theme HOT 8
- Listenimport plugin is currently broken
- Match smartplaylist options with playlist plugin
- deezer plugin doesn't handle pagination in tracklist
- In 2.0.0 (from git snapshot), running 'beet splupdate' (for smartplaylist) fails with TypeError whenever 'playlist:x' is in any query HOT 1
- File not found exception aborts import - occurs during "remove old"
- Migrate tests from `unittest` to `pytest` HOT 1
- I have two issues: 1st could not set permissions on... 2nd FileNotFoundError: [Errno 2] No such file or directory:... then crash!
- Remove Discogs label disambiguation number
- The Black Code Style - Extra empty lines (beets/ui/__init__.py) file HOT 1
- The integration tests workflow is broken
- `beet write`: false positive for changes in fields with multiple values HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beets.