From 7b065706d37df9e54c8b3299ce696545c6159fa4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 5 Dec 2015 02:32:19 +0000 Subject: tracklist: use lower number unique track IDs This is easier for users to read and type; and _might_ help with race conditions due to fast object recycling from GC. We'll also be implementing playist versioning on top of this in the next commits for MPD protocol compatibility. Unfortunately this adds an additional 40 bytes of per-track overhead (on 64-bit systems, its only 20 bytes on 32-bit). However, we may be able to save memory in the future by supporting dtas-mlib node IDs if we integrate dtas-player with DTAS::Mlib. While we're at it, include a minor speedup for DTAS::Tracklist#remove_track by using Array#delete_at instead of relying on Array#compact! after assignment This should improve "dtas-tl cat" output readability dramatically. The state file (~/.dtas/player_state.yml) remains compatible between dtas-player before and after this change. --- lib/dtas/track.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/dtas/track.rb (limited to 'lib/dtas/track.rb') diff --git a/lib/dtas/track.rb b/lib/dtas/track.rb new file mode 100644 index 0000000..215ee52 --- /dev/null +++ b/lib/dtas/track.rb @@ -0,0 +1,13 @@ +# Copyright (C) 2015 all contributors +# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +require_relative '../dtas' + +class DTAS::Track + attr_reader :track_id + attr_reader :to_path + + def initialize(track_id, path) + @track_id = track_id + @to_path = path + end +end -- cgit v1.2.3-24-ge0c7