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

Way to identify updated books #1092

Open
codykonior opened this issue Dec 22, 2024 · 0 comments
Open

Way to identify updated books #1092

codykonior opened this issue Dec 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@codykonior
Copy link

codykonior commented Dec 22, 2024

Sometimes Audible updates books. For example, The Wandering Inn on Audible US was 43 hours 10 minutes, but an update was released a week or two ago changing it to 48 hours with additional content.

This doesn't appear to be flagged at all in the Libation interface that I can see... if there is a way please tell me.

Otherwise I can understand why you'd maybe not want to automatically update from one version to another, but is there a way we can identify at least which ones have changed from previous downloads, so we can choose to update?

Edit: I see on a previous comment from 3 years ago you couldn't find a way to do this. But you could detect when the runtime changes, if you updated Libation to record the runtime for books when you downloaded them, versus what's in the metadata.

Currently you just overwrite the metadata with the new runtime and don't notify the user. So I guess if you could add a notification for that, that'd be great.

For anyone with existing libraries... well what I did was export my library in Libation in json format and write some PowerShell (on Mac) to get the runtimes of each file and compare with what's in the library. I noticed a few things.

  • For m4b, it's not uncommon for the file duration to be up to 3 minutes off from the LengthInMinutes recorded in the Libation library export. However, if you have file metadata downloads enabled, it will match the ChapterInfo.runtime_length_sec duration much closer.
  • For mp3, it's off by a lot and useless to compare.
  • I didn't bother with multi-part downloads or anything that converts to mp3. No thanks.
  • If you had continuous listening enabled in your iOS/Android app in the past (or due to some bug), Libation will have downloaded extra samples with the files. For these cases, the file duration is way off from the Libation duration, so for these you need to delete and re-download with Libation.
  • And otherwise the differences all appear to be changed files.

Anyway this will give those users a starting point:

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

$json = ConvertFrom-Json (Get-Content "Libation Library Export 2024-12-22.json" -Raw)
$files = Get-ChildItem *.m4b -Recurse

foreach ($jsonEntry in $json) {
    $file = $files | Where-Object { $_.FullName -like "*$($jsonEntry.AudibleProductId)*" }

    if (-not $file) {
        Write-Warning "File [$($jsonEntry.AudibleProductId)]: [$($jsonEntry.SeriesNames)] [$($jsonEntry.Title)] not found"
        continue
    } elseif (($file | Measure-Object).Count -ne 1) {
        Write-Warning "File [$($jsonEntry.AudibleProductId)]: [$($jsonEntry.SeriesNames)] [$($jsonEntry.Title)] has multiple files which complicates things"
        continue
    }

    $minutes = [int] ((&mdls $file.FullName -r -attr kMDItemDurationSeconds) / 60)
    # Note that if you had the .metadata.json file, the duration in there is far more accurate than this json entry
    if ([Math]::Abs($minutes - $jsonEntry.LengthInMinutes) -gt 3) {
        "File [$($file.Name)] is [$minutes] minutes versus [$($jsonEntry.LengthInMinutes)] minutes in Libation"
    }
}
@codykonior codykonior added the enhancement New feature or request label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant