Maksim Totmin 54cd87654f fix: reliable play count sync with auto-sync + deferred iTunesDB commit
Stops double-counting when iPod Nano 7G regenerates Play Counts
file after a DB write (firmware quirk, new mtime with stale data).

Architecture:
- Mount: only max(cache, base) — never reads Play Counts delta
- 2s after mount → auto-sync worker: reads delta, subtracts stored
  (persistent guard), applies effective to cache, defers DB write
- iTunesDB commit deferred to next stable mount (checks W_OK first)
- read_play_stats() uses 3s retry + read_play_counts_delta() fallback
  (filesystem-based PC parsing, independent of iTunesDB I/O errors)

Changes:
- ipod_nano7_db.py: sync_itunescdb() returns bool; new
  read_play_counts_delta() method; get_all_tracks() no longer adds
  delta; _merge_play_stats() drops delta addition; suppress iOpenPod
  ERROR logs to CRITICAL
- library_cache.py: schema v2 with playcounts_log table +
  get/set_last_synced_delta, migration from v1
- worker.py: session guards (_processed_fwids, _auto_synced_fwids,
  _pending_commit_fwids); auto_sync_playcounts task; deferred commit
  in mount
- app.py: QTimer.singleShot(2000) after mount for auto-sync
- ipod_tab.py: _on_auto_state_changed rewritten (no unmount, mp guard)
- library_tab.py: refresh_play_counts_from_cache() method
2026-06-02 00:54:18 +07:00

neo-pod-desktop

Desktop application for converting, managing and transferring music to iPod Nano 7G. Includes format conversion, metadata management, local library with playback, cover art pipeline, and full iTunesDB/ArtworkDB generation.

Features

  • Convert to iPod-compatible formats (AAC/M4A, MP3) with -map 0:t? cover preservation
  • Metadata handling -- title, artist, album, track number, genre, embedded cover art
  • Cover art pipeline -- extract from audio files (APIC/covr/FLAC pictures), encode to iPod Nano 7G formats (RGB565), write ArtworkDB + ithmb
  • iTunes-style player -- play local library with cover art display (60x60), seek, volume
  • iPod Nano 7G database -- full iTunesCDB sync, SQLite management, Locations.itdb with HASHAB checksums
  • Library management -- sortable table, source/ready track separation, bulk transfer
  • Portable AppImage -- scripts/build-appimage.sh builds standalone x86_64 AppImage
  • Config stored in ~/.config/neo-pod-desktop/config.ini

Installation

Dependencies

  • Python 3.14+
  • FFmpeg (for audio conversion)
  • libusb (for USB device access on Linux)
pip install -r requirements.txt

Install FFmpeg:

  • macOS: brew install ffmpeg
  • Linux: sudo apt-get install ffmpeg
  • Windows: Download from ffmpeg.org

Usage

GUI Application

python src/main.py

AppImage (portable)

./neo-pod-desktop-x86_64.AppImage

Build from source:

./scripts/build-appimage.sh

Project Structure

src/
  main.py                  -- GUI application (PyQt6)
  track_info.py            -- TrackInfo data class
  audio_converter.py       -- FFmpeg audio conversion
  metadata_handler.py      -- ID3/MP4 tag reading and writing
  metadata_editor.py       -- GUI metadata editing widget
  config_loader.py         -- Config in ~/.config/
  ipod_device.py           -- iPod device detection and file management
  ipod_nano7_db.py         -- Nano 7G SQLite + iTunesCDB + ArtworkDB
  ipod_mhbd_writer.py      -- Binary iTunesDB writer
  hashab.py                -- HASHAB checksum generation
  hotkeys.py               -- Global keyboard shortcut management
  library_cache.py         -- Local library caching
  artwork/
    __init__.py            -- Public API
    presets.py             -- 50+ iPod artwork format definitions
    types.py               -- ArtworkEntry, EncodedFormatPayload, IthmbLocation
    codecs.py              -- RGB565/RGB555/UYVY/JPEG encode/decode (numpy)
    extractor.py           -- Cover extraction from audio files (mutagen)
    chunks.py              -- ArtworkDB binary parser/writer (MHFD->MHII->MHNI)
    writer.py              -- ithmb file + ArtworkDB writing
    cache.py               -- Local JPEG cover cache for player UI
scripts/
  build-appimage.sh        -- AppImage builder (PyInstaller + appimagetool)

License

MIT License

Description
Desktop manager for iPod Nano 7G — download, convert, transfer music with cover art.
Readme 1.9 MiB
Languages
Python 98.4%
Shell 1.4%
Batchfile 0.2%