summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-17 03:09:59 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-17 03:09:59 +0000
commitb87ed96d6c566470214130722f5f150ce9f3d2b1 (patch)
treee61ccd7de766deaf5cc9051f40ae35e462b2485d
parent9b37eac602daeb6ec275b3da3977e5f3f54eb274 (diff)
automatic import of python-music-tag
-rw-r--r--.gitignore1
-rw-r--r--python-music-tag.spec681
-rw-r--r--sources1
3 files changed, 683 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..7a8b3f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/music-tag-0.4.3.tar.gz
diff --git a/python-music-tag.spec b/python-music-tag.spec
new file mode 100644
index 0000000..c2cec61
--- /dev/null
+++ b/python-music-tag.spec
@@ -0,0 +1,681 @@
+%global _empty_manifest_terminate_build 0
+Name: python-music-tag
+Version: 0.4.3
+Release: 1
+Summary: Simple interface to edit audio file metadata
+License: MIT
+URL: https://github.com/KristoforMaynard/music-tag
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/fc/f4/ebcdd2fc9bfaf569b795250090e4f4088dc65a5a3e32c53baa9bfc3fc296/music-tag-0.4.3.tar.gz
+BuildArch: noarch
+
+
+%description
+# music-tag
+
+music-tag is a library for editing audio metadata with an interface
+that does not depend on the underlying file format. In other words, editing
+mp3 files shouldn not be any different than flac, m4a, ... This library is
+just a layer on top of [mutagen](https://mutagen.readthedocs.io/en/latest/),
+which does all the heavy lifting.
+
+## Formats
+
+The following file formats are actively tested.
+
+- ``aac``
+- ``aiff``
+- ``dsf``
+- ``flac``
+- ``m4a``
+- ``mp3``
+- ``ogg``
+- ``opus``
+- ``wav``
+- ``wv``
+
+## Keys
+
+Metadata is available using a dictionary-like interface with the following keys.
+Keys are not case sensitive and can contain arbitrary whitespace, '-', and '_'
+characters. In other words, ``Album Artist``, ``album-artist``, and
+``album_artist`` are all synonyms for ``albumartist``. Also, ``disk`` is synonymous with ``disc``.
+
+- ``album``
+- ``albumartist``
+- ``artist``
+- ``artwork``
+- ``comment``
+- ``compilation``
+- ``composer``
+- ``discnumber``
+- ``genre``
+- ``lyrics``
+- ``totaldiscs``
+- ``totaltracks``
+- ``tracknumber``
+- ``tracktitle``
+- ``year``
+- ``isrc``
+- ``#bitrate`` (read only)
+- ``#codec`` (read only)
+- ``#length`` (read only)
+- ``#channels`` (read only)
+- ``#bitspersample`` (read only)
+- ``#samplerate`` (read only)
+
+## Examples
+
+### Reading tags
+
+``` python
+import music_tag
+
+f = music_tag.load_file("music-tag/sample/440Hz.m4a")
+
+# dict access returns a MetadataItem
+title_item = f['title']
+
+# MetadataItems keep track of multi-valued keys
+title_item.values # -> ['440Hz']
+
+# A single value can be extracted
+title_item.first # -> '440Hz'
+title_item.value # -> '440Hz'
+
+# MetadataItems can also be cast to a string
+str(title_item) # -> '440Hz'
+```
+
+### Setting tags
+
+``` python
+# tags can be set as if the file were a dictionary
+f['title'] = '440Hz'
+
+# additional values can be appended to the tags
+f.append_tag('title', 'subtitle')
+title_item.values # -> ['440Hz', 'subtitle']
+title_item.first # -> '440Hz'
+title_item.value # -> '440Hz, subtitle'
+str(title_item) # -> '440Hz, subtitle'
+```
+
+### Removing tags
+
+``` python
+del f['title']
+f.remove_tag('title')
+```
+
+### Album artwork
+
+Album artwork is wrapped in an object that keeps track of some of the
+extra metadata associated with images. Note that some album art functionality
+requires the Pillow (modern day PIL) library.
+
+``` python
+# get artwork
+art = f['artwork']
+
+# Note: `art` is a MetadataItem. Use ``art.value`` if there is
+# only one image embeded in the file. This will raise a
+# ValueError if there is more than one image. You can also
+# use ``art.first``, or iterate through ``art.values``.
+
+art.first.mime # -> 'image/jpeg'
+art.first.width # -> 1280
+art.first.height # -> 1280
+art.first.depth # -> 24
+art.first.data # -> b'... raw image data ...'
+
+# set artwork
+with open('music_tag/test/sample/imgA.jpg', 'rb') as img_in:
+ f['artwork'] = img_in.read()
+with open('music_tag/test/sample/imgB.jpg', 'rb') as img_in:
+ f.append_tag('artwork', img_in.read())
+
+# Make a thumbnail (requires Pillow)
+art.first.thumbnail([64, 64]) # -> pillow image
+art.first.raw_thumbnail([64, 64]) # -> b'... raw thumbnail data ...'
+```
+
+### Saving tags
+
+``` python
+# finally, you can bounce the edits to disk
+f.save()
+```
+
+### Skipping Type Normalization
+
+By default, tags are validated and normalized. For instance, track numbers
+and years are return as integers. Some tag formats store everything as strings
+to enable things like leading zeros in tracknumbers (i.e., track '01'). I think
+this is ugly, but you can use the file object's ``raw`` property if you like
+this kind of thing.
+
+``` python
+f.raw['tracknumber'] = '01'
+f.raw['tracknumber'].value # -> '01'
+```
+
+## Resolvers
+
+Some tags may not exist in a file, but there could be enough information to
+discern the correct value. For instance, the ``album artist`` tag is probably
+equal to the ``artist`` tag, or ``"Various Artists"`` if the ``compilation``
+flag is set. Here are some examples,
+
+``` python
+f['album artist'] = 'Brian'
+f.resolve('album artist') # <- 'Brian'
+f['artist'] = 'Brian'
+del f['album artist']
+f['compilation'] = False
+f.resolve('album artist') # <- 'Brian'
+f['compilation'] = True
+f.resolve('album artist') # <- 'Various Artists'
+
+del f['compilation']
+f['album artist'] = 'Various Artists'
+f.resolve('compilation') # <- True
+f['album artist'] = 'Brian'
+f.resolve('compilation') # <- False
+```
+
+## Command Line Tool
+
+The music_tag package can be used as a CLI to get / set tags. Here are some
+examples,
+
+### Printing Tags
+
+``` bash
+# Print tags from all audio files in sample directory
+python -m music_tag --print ./sample
+
+# Print specific tags from all audio files in sample directory
+python -m music_tag --print --tags="Title : Album" ./sample
+
+# Write tags from all audio files in sample directory to a csv file
+python -m music_tag --to-csv tags.csv ./sample
+
+# Write specific tags from all audio files in sample directory to a csv file
+python -m music_tag --tags="Title : Album" --to-csv tags.csv ./sample
+```
+
+### Setting Tags
+``` bash
+# Set a couple tags for multiple files
+python -m music_tag --set "genre:Pop" --set "comment:cli test" \
+ ./sample/440Hz.aac ./sample/440Hz.flac
+
+# Write tags from csv file to audio files (assuming file paths in
+# the csv file are relative to the sample directory
+python -m music_tag --from-csv tags.csv
+```
+
+%package -n python3-music-tag
+Summary: Simple interface to edit audio file metadata
+Provides: python-music-tag
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-music-tag
+# music-tag
+
+music-tag is a library for editing audio metadata with an interface
+that does not depend on the underlying file format. In other words, editing
+mp3 files shouldn not be any different than flac, m4a, ... This library is
+just a layer on top of [mutagen](https://mutagen.readthedocs.io/en/latest/),
+which does all the heavy lifting.
+
+## Formats
+
+The following file formats are actively tested.
+
+- ``aac``
+- ``aiff``
+- ``dsf``
+- ``flac``
+- ``m4a``
+- ``mp3``
+- ``ogg``
+- ``opus``
+- ``wav``
+- ``wv``
+
+## Keys
+
+Metadata is available using a dictionary-like interface with the following keys.
+Keys are not case sensitive and can contain arbitrary whitespace, '-', and '_'
+characters. In other words, ``Album Artist``, ``album-artist``, and
+``album_artist`` are all synonyms for ``albumartist``. Also, ``disk`` is synonymous with ``disc``.
+
+- ``album``
+- ``albumartist``
+- ``artist``
+- ``artwork``
+- ``comment``
+- ``compilation``
+- ``composer``
+- ``discnumber``
+- ``genre``
+- ``lyrics``
+- ``totaldiscs``
+- ``totaltracks``
+- ``tracknumber``
+- ``tracktitle``
+- ``year``
+- ``isrc``
+- ``#bitrate`` (read only)
+- ``#codec`` (read only)
+- ``#length`` (read only)
+- ``#channels`` (read only)
+- ``#bitspersample`` (read only)
+- ``#samplerate`` (read only)
+
+## Examples
+
+### Reading tags
+
+``` python
+import music_tag
+
+f = music_tag.load_file("music-tag/sample/440Hz.m4a")
+
+# dict access returns a MetadataItem
+title_item = f['title']
+
+# MetadataItems keep track of multi-valued keys
+title_item.values # -> ['440Hz']
+
+# A single value can be extracted
+title_item.first # -> '440Hz'
+title_item.value # -> '440Hz'
+
+# MetadataItems can also be cast to a string
+str(title_item) # -> '440Hz'
+```
+
+### Setting tags
+
+``` python
+# tags can be set as if the file were a dictionary
+f['title'] = '440Hz'
+
+# additional values can be appended to the tags
+f.append_tag('title', 'subtitle')
+title_item.values # -> ['440Hz', 'subtitle']
+title_item.first # -> '440Hz'
+title_item.value # -> '440Hz, subtitle'
+str(title_item) # -> '440Hz, subtitle'
+```
+
+### Removing tags
+
+``` python
+del f['title']
+f.remove_tag('title')
+```
+
+### Album artwork
+
+Album artwork is wrapped in an object that keeps track of some of the
+extra metadata associated with images. Note that some album art functionality
+requires the Pillow (modern day PIL) library.
+
+``` python
+# get artwork
+art = f['artwork']
+
+# Note: `art` is a MetadataItem. Use ``art.value`` if there is
+# only one image embeded in the file. This will raise a
+# ValueError if there is more than one image. You can also
+# use ``art.first``, or iterate through ``art.values``.
+
+art.first.mime # -> 'image/jpeg'
+art.first.width # -> 1280
+art.first.height # -> 1280
+art.first.depth # -> 24
+art.first.data # -> b'... raw image data ...'
+
+# set artwork
+with open('music_tag/test/sample/imgA.jpg', 'rb') as img_in:
+ f['artwork'] = img_in.read()
+with open('music_tag/test/sample/imgB.jpg', 'rb') as img_in:
+ f.append_tag('artwork', img_in.read())
+
+# Make a thumbnail (requires Pillow)
+art.first.thumbnail([64, 64]) # -> pillow image
+art.first.raw_thumbnail([64, 64]) # -> b'... raw thumbnail data ...'
+```
+
+### Saving tags
+
+``` python
+# finally, you can bounce the edits to disk
+f.save()
+```
+
+### Skipping Type Normalization
+
+By default, tags are validated and normalized. For instance, track numbers
+and years are return as integers. Some tag formats store everything as strings
+to enable things like leading zeros in tracknumbers (i.e., track '01'). I think
+this is ugly, but you can use the file object's ``raw`` property if you like
+this kind of thing.
+
+``` python
+f.raw['tracknumber'] = '01'
+f.raw['tracknumber'].value # -> '01'
+```
+
+## Resolvers
+
+Some tags may not exist in a file, but there could be enough information to
+discern the correct value. For instance, the ``album artist`` tag is probably
+equal to the ``artist`` tag, or ``"Various Artists"`` if the ``compilation``
+flag is set. Here are some examples,
+
+``` python
+f['album artist'] = 'Brian'
+f.resolve('album artist') # <- 'Brian'
+f['artist'] = 'Brian'
+del f['album artist']
+f['compilation'] = False
+f.resolve('album artist') # <- 'Brian'
+f['compilation'] = True
+f.resolve('album artist') # <- 'Various Artists'
+
+del f['compilation']
+f['album artist'] = 'Various Artists'
+f.resolve('compilation') # <- True
+f['album artist'] = 'Brian'
+f.resolve('compilation') # <- False
+```
+
+## Command Line Tool
+
+The music_tag package can be used as a CLI to get / set tags. Here are some
+examples,
+
+### Printing Tags
+
+``` bash
+# Print tags from all audio files in sample directory
+python -m music_tag --print ./sample
+
+# Print specific tags from all audio files in sample directory
+python -m music_tag --print --tags="Title : Album" ./sample
+
+# Write tags from all audio files in sample directory to a csv file
+python -m music_tag --to-csv tags.csv ./sample
+
+# Write specific tags from all audio files in sample directory to a csv file
+python -m music_tag --tags="Title : Album" --to-csv tags.csv ./sample
+```
+
+### Setting Tags
+``` bash
+# Set a couple tags for multiple files
+python -m music_tag --set "genre:Pop" --set "comment:cli test" \
+ ./sample/440Hz.aac ./sample/440Hz.flac
+
+# Write tags from csv file to audio files (assuming file paths in
+# the csv file are relative to the sample directory
+python -m music_tag --from-csv tags.csv
+```
+
+%package help
+Summary: Development documents and examples for music-tag
+Provides: python3-music-tag-doc
+%description help
+# music-tag
+
+music-tag is a library for editing audio metadata with an interface
+that does not depend on the underlying file format. In other words, editing
+mp3 files shouldn not be any different than flac, m4a, ... This library is
+just a layer on top of [mutagen](https://mutagen.readthedocs.io/en/latest/),
+which does all the heavy lifting.
+
+## Formats
+
+The following file formats are actively tested.
+
+- ``aac``
+- ``aiff``
+- ``dsf``
+- ``flac``
+- ``m4a``
+- ``mp3``
+- ``ogg``
+- ``opus``
+- ``wav``
+- ``wv``
+
+## Keys
+
+Metadata is available using a dictionary-like interface with the following keys.
+Keys are not case sensitive and can contain arbitrary whitespace, '-', and '_'
+characters. In other words, ``Album Artist``, ``album-artist``, and
+``album_artist`` are all synonyms for ``albumartist``. Also, ``disk`` is synonymous with ``disc``.
+
+- ``album``
+- ``albumartist``
+- ``artist``
+- ``artwork``
+- ``comment``
+- ``compilation``
+- ``composer``
+- ``discnumber``
+- ``genre``
+- ``lyrics``
+- ``totaldiscs``
+- ``totaltracks``
+- ``tracknumber``
+- ``tracktitle``
+- ``year``
+- ``isrc``
+- ``#bitrate`` (read only)
+- ``#codec`` (read only)
+- ``#length`` (read only)
+- ``#channels`` (read only)
+- ``#bitspersample`` (read only)
+- ``#samplerate`` (read only)
+
+## Examples
+
+### Reading tags
+
+``` python
+import music_tag
+
+f = music_tag.load_file("music-tag/sample/440Hz.m4a")
+
+# dict access returns a MetadataItem
+title_item = f['title']
+
+# MetadataItems keep track of multi-valued keys
+title_item.values # -> ['440Hz']
+
+# A single value can be extracted
+title_item.first # -> '440Hz'
+title_item.value # -> '440Hz'
+
+# MetadataItems can also be cast to a string
+str(title_item) # -> '440Hz'
+```
+
+### Setting tags
+
+``` python
+# tags can be set as if the file were a dictionary
+f['title'] = '440Hz'
+
+# additional values can be appended to the tags
+f.append_tag('title', 'subtitle')
+title_item.values # -> ['440Hz', 'subtitle']
+title_item.first # -> '440Hz'
+title_item.value # -> '440Hz, subtitle'
+str(title_item) # -> '440Hz, subtitle'
+```
+
+### Removing tags
+
+``` python
+del f['title']
+f.remove_tag('title')
+```
+
+### Album artwork
+
+Album artwork is wrapped in an object that keeps track of some of the
+extra metadata associated with images. Note that some album art functionality
+requires the Pillow (modern day PIL) library.
+
+``` python
+# get artwork
+art = f['artwork']
+
+# Note: `art` is a MetadataItem. Use ``art.value`` if there is
+# only one image embeded in the file. This will raise a
+# ValueError if there is more than one image. You can also
+# use ``art.first``, or iterate through ``art.values``.
+
+art.first.mime # -> 'image/jpeg'
+art.first.width # -> 1280
+art.first.height # -> 1280
+art.first.depth # -> 24
+art.first.data # -> b'... raw image data ...'
+
+# set artwork
+with open('music_tag/test/sample/imgA.jpg', 'rb') as img_in:
+ f['artwork'] = img_in.read()
+with open('music_tag/test/sample/imgB.jpg', 'rb') as img_in:
+ f.append_tag('artwork', img_in.read())
+
+# Make a thumbnail (requires Pillow)
+art.first.thumbnail([64, 64]) # -> pillow image
+art.first.raw_thumbnail([64, 64]) # -> b'... raw thumbnail data ...'
+```
+
+### Saving tags
+
+``` python
+# finally, you can bounce the edits to disk
+f.save()
+```
+
+### Skipping Type Normalization
+
+By default, tags are validated and normalized. For instance, track numbers
+and years are return as integers. Some tag formats store everything as strings
+to enable things like leading zeros in tracknumbers (i.e., track '01'). I think
+this is ugly, but you can use the file object's ``raw`` property if you like
+this kind of thing.
+
+``` python
+f.raw['tracknumber'] = '01'
+f.raw['tracknumber'].value # -> '01'
+```
+
+## Resolvers
+
+Some tags may not exist in a file, but there could be enough information to
+discern the correct value. For instance, the ``album artist`` tag is probably
+equal to the ``artist`` tag, or ``"Various Artists"`` if the ``compilation``
+flag is set. Here are some examples,
+
+``` python
+f['album artist'] = 'Brian'
+f.resolve('album artist') # <- 'Brian'
+f['artist'] = 'Brian'
+del f['album artist']
+f['compilation'] = False
+f.resolve('album artist') # <- 'Brian'
+f['compilation'] = True
+f.resolve('album artist') # <- 'Various Artists'
+
+del f['compilation']
+f['album artist'] = 'Various Artists'
+f.resolve('compilation') # <- True
+f['album artist'] = 'Brian'
+f.resolve('compilation') # <- False
+```
+
+## Command Line Tool
+
+The music_tag package can be used as a CLI to get / set tags. Here are some
+examples,
+
+### Printing Tags
+
+``` bash
+# Print tags from all audio files in sample directory
+python -m music_tag --print ./sample
+
+# Print specific tags from all audio files in sample directory
+python -m music_tag --print --tags="Title : Album" ./sample
+
+# Write tags from all audio files in sample directory to a csv file
+python -m music_tag --to-csv tags.csv ./sample
+
+# Write specific tags from all audio files in sample directory to a csv file
+python -m music_tag --tags="Title : Album" --to-csv tags.csv ./sample
+```
+
+### Setting Tags
+``` bash
+# Set a couple tags for multiple files
+python -m music_tag --set "genre:Pop" --set "comment:cli test" \
+ ./sample/440Hz.aac ./sample/440Hz.flac
+
+# Write tags from csv file to audio files (assuming file paths in
+# the csv file are relative to the sample directory
+python -m music_tag --from-csv tags.csv
+```
+
+%prep
+%autosetup -n music-tag-0.4.3
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-music-tag -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 17 2023 Python_Bot <Python_Bot@openeuler.org> - 0.4.3-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..ea6b7e5
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+ace5be9fe210478a0f89ff62fa62d179 music-tag-0.4.3.tar.gz