Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update only new albums #79

Open
brendan-pike opened this issue Sep 5, 2018 · 3 comments
Open

Update only new albums #79

brendan-pike opened this issue Sep 5, 2018 · 3 comments

Comments

@brendan-pike
Copy link
Contributor

Wondering if its possible to add a "Index new albums" functions, where we only index albums added since the last "update all" or "index new albums" call. In linux it should be pretty easy to find new directories since the last indexing call.

@ArturSierzant
Copy link
Owner

When you choose 'Update all' O!MPD scans whole media_dir and search new and modified files and dirs. While finding new dirs could be quite fast, finding modified files takes more time. It happens because when you modify a file, the modification time is changed only for this file, not for the directory the file is in (at least it works like this in Linux) - that's why O!MPD must read each file and it takes time...
I guess that your aim is to reduce time needed to update DB after adding some new albums. To speed up update I could do as you suggested: add new button like 'Update only new files' - I'll think about it.

But if you only want to add single album, you can update DB very fast:

  1. in file browser navigate to this album and from directory submenu choose 'Update this directory in database and MPD'

or

  1. in 'Config -> Update -> Select directory' browse to new album and then click 'Update this directory only'

Both of the above ways are much faster and I use them more often then 'Update all'.

@brendan-pike
Copy link
Contributor Author

I'll often add say a dozen new albums at a time, so manually finding and updating each would be rather annoying. I'm not sure you are correct about how linux utilised time stamps though. For example I just added 8 new albums, my top level directory now has 2747 folders. When I use a simple "ls -ltr" command the last several folders are correctly listed as the ones most recently added to:

drwxr-xr-x   3 bedlore bedlore  4096 Sep 14 14:14 John Fogerty
drwxr-xr-x   3 bedlore bedlore  4096 Sep 14 14:15 Son Sungjae
drwxr-xr-x   8 bedlore bedlore  4096 Sep 14 14:15 Iron & Wine
drwxr-xr-x   3 bedlore bedlore  4096 Sep 14 14:15 Charles Lloyd & The Marvels + Lucinda Williams
drwxr-xr-x   5 bedlore bedlore  4096 Sep 14 14:16 Ry Cooder
drwxr-xr-x   4 bedlore bedlore  4096 Sep 14 14:17 Algiers
drwxr-xr-x   3 bedlore bedlore  4096 Sep 14 14:17 Bombino

Furthering the example, the Iron & Wine folder holds 6 albums, so the top level folder has existed for a long time, yet is listed, probably because of the modified date perhaps. ie.

bedlore@hyssop /mnt/Audio/Lossless $ stat  Iron\ \&\ Wine/
  File: 'Iron & Wine/'
  Size: 4096      	Blocks: 16         IO Block: 4096   directory
Device: 2dh/45d	Inode: 198541339   Links: 8
Access: (0755/drwxr-xr-x)  Uid: ( 1000/ bedlore)   Gid: ( 1000/ bedlore)
Access: 2018-09-14 14:22:53.917774272 +0930
Modify: 2018-09-14 14:15:43.378156758 +0930
Change: 2018-09-14 14:15:57.000000000 +0930
 Birth: -

But I assume this could be done several ways, with a find command date limited etc.

@ArturSierzant
Copy link
Owner

That's why I wrote that finding new dirs is quite fast. Problem is when you modify existing file, e.g. you change tags in a file. Then modification date is only changed for that file, not for the containing directory. That's why when you choose 'Update All' O!MPD checks all files (i.e. all files in directories which weren't changed since last update; the ones that were are assumed to have new files/dirs and are added to update list without further checking). Anyway updating all files (both new and changed) requires checking modification date for almost all files in media dir - maybe there is a faster way to find changed files, but I couldn't find it...
But I think adding button 'Update only new files' is good idea. Due to above, it would only add new files/directories. I'll add it to TODO list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants