| 1 |
# Copyright (C) 2008-2010 Adam Olsen |
| 2 |
# Copyright (C) 2025 Johannes Sasongko <johannes sasongko org> |
| 3 |
# |
| 4 |
# This program is free software; you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU General Public License as published by |
| 6 |
# the Free Software Foundation; either version 2, or (at your option) |
| 7 |
# any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program; if not, write to the Free Software |
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 |
# |
| 18 |
# |
| 19 |
# The developers of the Exaile media player hereby grant permission |
| 20 |
# for non-GPL compatible GStreamer and Exaile plugins to be used and |
| 21 |
# distributed together with GStreamer and Exaile. This permission is |
| 22 |
# above and beyond the permissions granted by the GPL license by which |
| 23 |
# Exaile is covered. If you modify this code, you may extend this |
| 24 |
# exception to your version of the code, but you are not obligated to |
| 25 |
# do so. If you do not wish to do so, delete this exception statement |
| 26 |
# from your version. |
| 27 |
|
| 28 |
|
| 29 |
from xl.metadata._base import BaseFormat |
| 30 |
|
| 31 |
|
| 32 |
class SidFormat(BaseFormat): |
| 33 |
writable = False |
| 34 |
|
| 35 |
def load(self): |
| 36 |
with open(self.loc, 'rb') as f: |
| 37 |
# Search for "+16" in |
| 38 |
# https://www.hvsc.c64.org/download/C64Music/DOCUMENTS/SID_file_format.txt |
| 39 |
f.seek(0x16) |
| 40 |
read = lambda: f.read(32).split(b'\0', 1)[0].decode('cp1252', 'replace') |
| 41 |
self.mutagen = { |
| 42 |
'title': read(), |
| 43 |
'artist': read(), |
| 44 |
'copyright': read(), |
| 45 |
} |