Giter VIP home page Giter VIP logo

opustags's People

Contributors

akx avatar fmang avatar hackerb9 avatar perfstack avatar rrthomas avatar sporksnail avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

opustags's Issues

Detect read-only mode and apply consequences

  • In read-only mode, user can only --list tags, and it happens by default.
  • In non-read-only mode, user selects the path to the output file (or --in-place), and is able to run any operation. The thing is that --list no longer happens by default.

This needs to be implemented, probably as a sort of a post-action in options.cc.

No package 'ogg' found

Hi,

I installed both libogg0 and libogg-dev but still ccmake says :

-- Checking for module 'ogg'
--   No package 'ogg' found
CMake Error at /usr/local/miniconda3/lib/python3.6/site-packages/cmake/data/share/cmake-3.13/Modules/FindPkgConfig.cmake:452 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/local/miniconda3/lib/python3.6/site-packages/cmake/data/share/cmake-3.13/Modules/FindPkgConfig.cmake:622 (_pkg_check_modules_internal)
  CMakeLists.txt:13 (pkg_check_modules)


-- Configuring incomplete, errors occurred!
See also "/home/xyztabcd/src/opustags/build/CMakeFiles/CMakeOutput.log".

feature request: support globs for -d

usecase:
When reindexing an opus file (i.e., an opus file that already has a time/chapter name index), it appears that the only way to remove the index is to iterate through each of those chapter tags (which must be known) and deleted using -d:

#!/bin/bash

title=Title\ for\ Testing\ --\ Audiobook.opus
tags=( $(opustags "$title") )
tags2=( $(printf '%s\n' "${tags[@]%=*}"|grep CHAPTER|sort -u) )
printf "%s\n" "${tags2[@]}"
for i in "${tags2[@]}"
  do
    opustags -i -d "$i" "$title"
  done

mediainfo "$title"

exit

$ opustags -d CHAPTER* appears to me to be far simpler than the above loop.

Implement --full

Not sure what this switch means decoding-wise, but for now it's dangling unused.

Possible smart ordering of CLI switches

Right now this call

opustags --add ARTIST=omg --delete ARTIST

adds ARTIST and then deletes the ARTIST, which results in removal of all prior ARTIST entries and not adding ARTIST=omg entry. The proposition is to introduce "smart ordering" (I just called it that) to CLI arguments so that it's always like this:

  1. Global operations such as -e, --import, --delete-all
  2. Deletion operations (--delete)
  3. Update operations (--set)
  4. Insertion operations (--add)

With this, it'd remove all the ARTIST entries and add one ARTIST=omg entry, essentially replacing all artists with omg.

I'm not a fan of this approach since, beside sub-ideal code it needs to introduce, it feels kind of counter-intuitive to me; after all I just told the program to add a tag, and then delete a tag. I'd expect it to do just that - the fact it's a silly thing to do is just my fault for telling it to do something silly.

We could use external opinion on this.

Feature request: equivalent of metaflac's remove-all-tags-except

--remove-all-tags-except=NAME1[=NAME2[=...]] Remove all tags, except the vendor string and the tag names specified. Tag names must be separated by an = character.

Example:
--remove-all-tags-except=TITLE=ARTIST=METADATA_BLOCK_PICTURE
This would delete every tag except the title and artist tags, and the cover art, from an Opus file.

Thank you for this tool, it works perfectly.

Why treat empty filenames specially?

opustags complains if a filename argument is empty. Most programs don't do this, they will just give an error when they try to open a file with an empty name.

Output is not fully written

When editing tags, the output file is not completely written. This happens every time the program is run. The output file size is consistent between runs on the same input, but has different length on other inputs.

> build/opustags --output output.opus --add title=Title sample.opus 
> ls -l *.opus
-rw-rw-r-- 1 bruce users    789908 Sep 22 17:53 output.opus
-rw-rw-r-- 1 bruce users   2857825 Sep 22 17:47 sample.opus

The resulting output file, when played through ffmpeg (via mpv), reports missing granules as well:

Playing: output.opus
[ffmpeg/demuxer] ogg: Page at 160 is missing granule
[ffmpeg/demuxer] ogg: Page at 160 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1
[ffmpeg/demuxer] ogg: Page at 160 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1
 (+) Audio --aid=1 --alang=eng 'Title' (opus 2ch 48000Hz)
File tags:
 Title: Title
[ffmpeg/demuxer] ogg: Page at 160 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1
[ffmpeg/demuxer] ogg: Page at 160 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1
.....
[ffmpeg/demuxer] ogg: Page at 201024 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1
[ffmpeg/demuxer] ogg: Page at 201024 is missing granule
[ffmpeg/demuxer] ogg: Unsupported huge granule pos -1

The file plays, but is truncated.

opustags was built with GCC 5.4.0 and linked against libogg-1.3.2

"Writing/encoding library" information

Hello,

opusenc from opus-tools adds the comments ENCODER and ENCODER_OPTIONS which can be modified or deleted via opustags fine. Is it possible to modify or delete the encoding library information however? For an .opus file that has been encoded with opusenc for example, this information is shown by MediaInfo's "Writing library" parameter as "libopus 1.3, libopusenc 0.2.1".

My skills in C are very poor (almost zero). Looking at the code here, here and here, I believe this information is stored in the comment header, so differently than the other comments? Can this be accessed by opustags?

I was able to change the string via modifying the relevant code and compiling opus-tools as a test, but if this is stored in the comment header I'm not sure if it can be removed.

EDIT: Obviously the encoding library information is not only written by opusenc (like the ENCODER and ENCODER_OPTIONS tags) but by other tools as well (ffmpeg stores its own string).

Better error messages

When I give an invalid file to the command-line, I get invalid stream to decode following by my shell prompt because it doesn't end with a newline.

The thrown exceptions should be caught and displayed nicely instead. Also, I'd except something like “No such file or directory”.

Implement the CLI facade

Right now everything we've done may be covered by unit tests which is nice, but it hasn't been used in any way in main.cc. We should finally make a working facade that does something, and test it, ideally w/o spawning a new process (because it's fragile).

Open fd to source file prevents inplace rename on SMB

When using --in-place rename,

if (rename(temporary_name.c_str(), final_name.c_str()) == -1)
it fails on SMB mounts because final_name resolves to the input file which is not yet closed. The syscall returns an EACCES instead. I confirmed this in strace as well.

I'm not quite sure how much of this is WAI on the FS side but this is 100% reproducible on my end. Closing the source file before the rename solves this issue.

Incorrect CMake version requirement

README.md states that CMake version >= 3.9 is required.
I have CMake 3.10 and I can't build the project since FindIconv module is missing

$ cmake --version
cmake version 3.10.2
$ cmake ..
CMake Error at CMakeLists.txt:22 (include):
  include could not find load file:

    FindIconv

According to CMake documentation FindIconv module was added in 3.11

Win/MingW build doesn't support getline() and mkstemps()

The latest 1.8 version of opustags adds an important fix for the infamous "Reading header packets spanning multiple pages are not yet supported." drawback.

However only the older, buggy 1.6 binary can be compiled and found 'round the net because, from the hydrogenaudio forum: "The current version of opustags relies on at least two POSIX functions - getline() and mkstemps() - that haven't been implemented in Mingw-w64 yet" https://hydrogenaud.io/index.php/topic,121444.msg1026198.html#msg1026198

Could you please re-add Win/MinGW support, or are these two POSIX funtions the exact ones that are required to fix the bug and/or add features like cover picture support? The alternative could be a Cygwin version with its POSIX wrappers, but this would have to be tested for any regressions.

Multiple input files

When editing in-place, one might want to edit many files at once, and it'd be natural to try opustags --set ALBUM=Abc --in-place *.ogg.

It could also be applied when listing.

It's not essential though, as it's just as easy to make a for loop in bash.

opustags fails if there is album art (theora) data in the file.

# ffprobe file.ogg
Input #0, ogg, from '':
  Duration: 00:04:27.73, start: 0.000000, bitrate: 199 kb/s
  Stream #0:0: Video: theora, yuv444p, 800x800 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)
      encoder         : Lavc58.75.100 libtheora
  Stream #0:1: Audio: opus, 48000 Hz, stereo, fltp
    Metadata:
      encoder         : Lavc58.75.100 libopus
# opustags file.ogg
file.ogg: error: Not an Opus stream.

--editor

Blocked by parsers that #1 is going to introduce, user should be able to edit the tags in --import fashion via $EDITOR.

Not sure how to spawn processes nicely in portable fashion, I'm probably going to use the dreaded system() call since that's what seems most to be the most portable.

What are the opus tags supported?

I found this project while searching for that and it would be most helpful if you would include that information somewhere, e.g., in the man page.

Support for newlines in tags

Request

Please add support for newlines in tags. While I do not usually add newlines to the tags, it is extremely common to find them already existing in .opus files that have been downloaded, especially from YouTube via youtube-dl -x.

The problem

Currently, when using opustags -e on a file with newlines in the comments, opustags will not give any warning that it cannot preserve the newlines. Instead, when the file is saved, opustags dies badly, incorrectly stating that a tag is malformed.

warning: Leaving foobird.opus.BejwAL.opustags on the disk.
Stravinsky - The Firebird _ Gergiev · Vienna Philarmonic · Salzburg Festival 2000.opus: error: Malformed tag: Great presentation of the Vienna Philharmonic conducted by the russian Maestro Valery Gergiev, in one of the most powerful and greatest presentation of The Firebird (L'Oiseau de feu) of Igor Stravinsky at Salzburg Festival 2000.

Possible Solution

I suggest automatically converting a tag with multiple paragraphs into a multiple instances of the same tag. For example:

title=Stravinsky: The Firebird / Gergiev · Vienna Philarmonic · Salzburg Festival 2000
date=20111106
DESCRIPTION=Gran presentación de la Orquesta Filarmónica de Viena, conducida por el director ruso Valery Gergiev en [a mi juicio personal] una de las más grandes y magníficas interpretaciones del Pájaro de Fuego (L'Oiseau de feu) de Igor Stravinsky, que se tenga conocimiento, durante el Festival de Salzburgo 2000.

Great presentation of the Vienna Philharmonic conducted by the russian Maestro Valery Gergiev, in one of the most powerful and greatest presentation of The Firebird (L'Oiseau de feu) of Igor Stravinsky at Salzburg Festival 2000.

would become

title=Stravinsky: The Firebird / Gergiev · Vienna Philarmonic · Salzburg Festival 2000
date=20111106
DESCRIPTION=Gran presentación de la Orquesta Filarmónica de Viena, conducida por el director ruso Valery Gergiev en [a mi juicio personal] una de las más grandes y magníficas interpretaciones del Pájaro de Fuego (L'Oiseau de feu) de Igor Stravinsky, que se tenga conocimiento, durante el Festival de Salzburgo 2000.
DESCRIPTION=
DESCRIPTION=Great presentation of the Vienna Philharmonic conducted by the russian Maestro Valery Gergiev, in one of the most powerful and greatest presentation of The Firebird (L'Oiseau de feu) of Igor Stravinsky at Salzburg Festival 2000.

Reuse of a tag like this is explicitly allowed in the Vorbis comment specification, so I believe this is a good solution.

Example Kludge

I have a kludge which kind of works to add repeated tags, but only as long as the contents of a tag does not have an equals sign (=).

opustags foo.opus | awk -F= '
    $2 != "" { tag=$1; }; 
    $2 == "" { printf("%s=", tag) }; 
    {print}
 ' | opustags --set-all foo.opus -o bar.opus

If I'm lucky and there were no equals signs in the data, I can then use opustags -e bar.opus without error. I present this fragile kludge only as an example. Any generally applicable solution will require modifying opustags.

Fails to build on macos high sierra

I am currently reviewing the NixOS package update to 1.5.0 (NixOS/nixpkgs#103484) which breaks building on MacOS with the following error:

these derivations will be built:                                                                                                                                                              /nix/store/n3ajm7hfx6r33k8n4wkbl8ap86sv2y6h-opustags-1.5.1.drv                                                                                                                            building '/nix/store/n3ajm7hfx6r33k8n4wkbl8ap86sv2y6h-opustags-1.5.1.drv'...                                                                                                                unpacking sources                                                                                                                                                                           unpacking source archive /nix/store/gbbiyd793s21iimmgdgzjr3s8ahfsfpl-source                                                                                                                 source root is source                                                                                                                                                                       patching sources                                                                                                                                                                            configuring                                                                                                                                                                                 fixing cmake files...                                                                                                                                                                       cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/share/doc/opustags -DCMAKE_INSTALL_INFODIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/include -DCMAKE_INSTALL_SBINDIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/l5707pca91sq99fd5fq4x84302zssyjj-cctools-binutils-darwin-949.0.1/bin/strip -DCMAKE_RANLIB=/nix/store/l5707pca91sq99fd5fq4x84302zssyjj-cctools-binutils-darwin-949.0.1/bin/ranlib -DCMAKE_AR=/nix/store/l5707pca91sq99fd5fq4x84302zssyjj-cctools-binutils-darwin-949.0.1/bin/ar -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_INSTALL_PREFIX=/nix/store/83vmz7l3ksy68fgqzb5pz8dqwbr0dw8h-opustags-1.5.1                                                                                                         -- The CXX compiler identification is Clang 7.1.0                                                                                                                                           -- Detecting CXX compiler ABI info                                                                                                                                                          -- Detecting CXX compiler ABI info - done                                                                                                                                                   -- Check for working CXX compiler: /nix/store/b2qvdc4738nl7d8bn6d5gb6p9s34c78v-clang-wrapper-7.1.0/bin/clang++ - skipped                                                                    -- Detecting CXX compile features                                                                                                                                                           -- Detecting CXX compile features - done                                                                                                                                                    -- Found PkgConfig: pkg-config (found version "0.29.2")                                                                                                                                     -- Checking for module 'ogg'                                                                                                                                                                --   Found ogg, version 1.3.4                                                                                                                                                               -- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Failed
-- Found Iconv: /nix/store/x3r5250ll1k97j6n7sn9k035wz9n7jnz-libiconv-osx-10.12.6/lib/libiconv.dylib
-- Looking for C++ include endian.h
-- Looking for C++ include endian.h - not found
-- Looking for C++ include sys/endian.h
-- Looking for C++ include sys/endian.h - not found
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING
    CMAKE_C_COMPILER
    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_POLICY_DEFAULT_CMP0025


-- Build files have been written to: /tmp/nix-build-opustags-1.5.1.drv-0/source/build
cmake: enabled parallel building
building
build flags: -j4 -l4 SHELL=/nix/store/k89nm2jva0qmvd970f84wq2iq1iwm9bs-bash-4.4-p23/bin/bash
Scanning dependencies of target ot
[ 14%] Building CXX object CMakeFiles/ot.dir/src/cli.cc.o
[ 28%] Building CXX object CMakeFiles/ot.dir/src/ogg.cc.o
[ 42%] Building CXX object CMakeFiles/ot.dir/src/opus.cc.o
[ 57%] Building CXX object CMakeFiles/ot.dir/src/system.cc.o
/tmp/nix-build-opustags-1.5.1.drv-0/source/src/system.cc:182:13: error: no member named 'st_mtim' in 'stat'
        mtime = st.st_mtim; // more precise than st_mtime
                ~~ ^
1 error generated.
make[2]: *** [CMakeFiles/ot.dir/build.make:121: CMakeFiles/ot.dir/src/system.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:149: CMakeFiles/ot.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
builder for '/nix/store/n3ajm7hfx6r33k8n4wkbl8ap86sv2y6h-opustags-1.5.1.drv' failed with exit code 2
error: build of '/nix/store/n3ajm7hfx6r33k8n4wkbl8ap86sv2y6h-opustags-1.5.1.drv' failed

I think this is an issue in your source code. If you need someone for testing feel free to ping me.

make install : opustags/src/cli.cc:13:0: error: ‘make_unique’ is not a member of ‘std’

Hi,

I have a pb. with sudo make install :

$ sudo make install
[sudo] password for xyztabcd:              
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xyztabcd/src/opustags/build
Scanning dependencies of target libopustags
[ 20%] Building CXX object CMakeFiles/libopustags.dir/src/cli.cc.o
In file included from /home/xyztabcd/src/opustags/src/cli.cc:13:0:
/home/xyztabcd/src/opustags/src/opustags.h: In constructor ‘ot::dynamic_ogg_packet::dynamic_ogg_packet(size_t)’:
/home/xyztabcd/src/opustags/src/opustags.h:271:10: error: ‘make_unique’ is not a member of ‘std’
   data = std::make_unique<unsigned char[]>(size);
          ^
/home/xyztabcd/src/opustags/src/opustags.h:271:27: error: expected primary-expression before ‘unsigned’
   data = std::make_unique<unsigned char[]>(size);
                           ^
/home/xyztabcd/src/opustags/src/opustags.h:271:27: error: expected ‘;’ before ‘unsigned’
/home/xyztabcd/src/opustags/src/cli.cc: In function ‘ot::status ot::run(ot::options&)’:
/home/xyztabcd/src/opustags/src/cli.cc:310:13: error: ‘make_unique’ is not a member of ‘std’
    writer = std::make_unique<ot::ogg_writer>(output.get());
             ^
/home/xyztabcd/src/opustags/src/cli.cc:310:44: error: expected primary-expression before ‘>’ token
    writer = std::make_unique<ot::ogg_writer>(output.get());
                                            ^
make[2]: *** [CMakeFiles/libopustags.dir/src/cli.cc.o] Error 1
make[1]: *** [CMakeFiles/libopustags.dir/all] Error 2
make: *** [all] Error 2

Can you help me ?

File timestamps are modified when no tags were removed

Using a tagname that doesn't exist when deleting a tag, or trying to delete a tag twice doesn't modify the file contents, but it changes the file timestamps.

It would be better if opustags could check whether any tag changes would be made, and only change the file timestamps if thats the case.

Feature request

When starting with an opus file one wants to use opustags on, there's no information known about the existing tags. Using a utility like ffprobe or mediainfo give some information, but largely they do not show what the actual tags for which the values are being changed.
(I.e., TITLE is a tag with a value of "The Title Book" for The Title Book.)

At present, I do not know whether opustags is case sensitive for the tag, but I suspect it is. It does not appear that opustags treats the tags as case sensitive for the purposes of matching existing tags, but it does preserve the case when it saves.

If I really want the raw tags as opustags itself sees as the raw tags, the only option I can find is e.g., opustags -e title_book.opus -o title_book-e.opus . This shows what the tags are, caps state, etc.:

encoder=Lavc60.6.101 libopus
ALBUMARTIST=An Artist
artist=An Artist
album=The Title Book
title=001 - The Title Book
TRACKNUMBER=001
genre=Audiobook
TLEN=169906
DESCRIPTION=Read by A. Dude
date=2011

The ability to list the tags that opustags actually sees, as opposed to the format that e.g., mediainfo puts them in would be most helpful in this regard.

So what I would like is a -l that will pull the information that goes to nano but List it to STDOUT instead:

$ opustags -l title_book.opus
encoder=Lavc60.6.101 libopus
ALBUMARTIST=An Artist
artist=An Artist
album=The Title Book
title=001 - The Title Book
TRACKNUMBER=001
genre=Audiobook
TLEN=169906
DESCRIPTION=Read by A. Dude
date=2011

$opustags -s ALBUMARTIST="Artist, An" -i title_book.opus

Add support for reading header packets spanning multiple pages

Hi,

I'm trying to use opustags (built just now from the master branch) to embed lyrics in my music collection, but I keep running into this error message no matter which command-line options I pass:

error: Reading header packets spanning multiple pages are not yet supported. Please file an issue to make your wish known.

The file that's causing this issue was downloaded from YouTube with:

yt-dlp --extract-audio --audio-format opus --audio-quality 0 --embed-metadata --embed-thumbnail --sponsorblock-mark all --output '%(artist)s - %(track)s.%(ext)s' 'https://youtube.com/watch?v=xgIU9e1W0uU'

Fails to build on ArchLinux with both GCC-14.1.1 and clang-17.0.6 .

clang-17.0.6

[2/8] Building CXX object CMakeFiles/ot.dir/src/opus.cc.o
FAILED: CMakeFiles/ot.dir/src/opus.cc.o 
/usr/bin/clang++ -D_GNU_SOURCE -I/dev/shm/testbuild/opustags/build -I/dev/shm/testbuild/opustags/src -march=native -pipe -O3 -DNDEBUG -std=gnu++20 -I/usr/include -MD -MT CMakeFiles/ot.dir/src/opus.cc.o -MF CMakeFiles/ot.dir/src/opus.cc.o.d -o CMakeFiles/ot.dir/src/opus.cc.o -c /dev/shm/testbuild/opustags/src/opus.cc
/dev/shm/testbuild/opustags/src/opus.cc:171:19: error: no member named 'find_if' in namespace 'std'; did you mean 'std::ranges::find_if'?
  171 |         auto cover_tag = std::find_if(tags.comments.begin(), tags.comments.end(), is_cover);
      |                          ^~~~~~~~~~~~
      |                          std::ranges::find_if
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/ranges_util.h:543:33: note: 'std::ranges::find_if' declared here
  543 |   inline constexpr __find_if_fn find_if{};
      |                                 ^
/dev/shm/testbuild/opustags/src/opus.cc:175:25: error: no member named 'find_if' in namespace 'std'; did you mean 'std::ranges::find_if'?
  175 |         auto extra_cover_tag = std::find_if(std::next(cover_tag), tags.comments.end(), is_cover);
      |                                ^~~~~~~~~~~~
      |                                std::ranges::find_if
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/ranges_util.h:543:33: note: 'std::ranges::find_if' declared here
  543 |   inline constexpr __find_if_fn find_if{};
      |                                 ^
2 errors generated.
[4/8] Building CXX object CMakeFiles/ot.dir/src/cli.cc.o
FAILED: CMakeFiles/ot.dir/src/cli.cc.o 
/usr/bin/clang++ -D_GNU_SOURCE -I/dev/shm/testbuild/opustags/build -I/dev/shm/testbuild/opustags/src -march=native -pipe -O3 -DNDEBUG -std=gnu++20 -I/usr/include -MD -MT CMakeFiles/ot.dir/src/cli.cc.o -MF CMakeFiles/ot.dir/src/cli.cc.o.d -o CMakeFiles/ot.dir/src/cli.cc.o -c /dev/shm/testbuild/opustags/src/cli.cc
/dev/shm/testbuild/opustags/src/cli.cc:177:8: error: no member named 'transform' in namespace 'std'
  177 |                 std::transform(local_to_add.begin(), local_to_add.end(),
      |                 ~~~~~^
/dev/shm/testbuild/opustags/src/cli.cc:179:8: error: no member named 'transform' in namespace 'std'
  179 |                 std::transform(local_to_delete.begin(), local_to_delete.end(),
      |                 ~~~~~^
/dev/shm/testbuild/opustags/src/cli.cc:185:9: error: no member named 'transform' in namespace 'std'
  185 |                         std::transform(local_to_add.begin(), local_to_add.end(),
      |                         ~~~~~^
/dev/shm/testbuild/opustags/src/cli.cc:187:9: error: no member named 'transform' in namespace 'std'
  187 |                         std::transform(local_to_delete.begin(), local_to_delete.end(),
      |                         ~~~~~^
/dev/shm/testbuild/opustags/src/cli.cc:243:28: error: no member named 'count' in namespace 'std'
  243 |         auto newline_count = std::count(source.begin(), source.end(), opt.tag_delimiter);
      |                              ~~~~~^
5 errors generated.
[6/8] Building CXX object CMakeFiles/ot.dir/src/system.cc.o
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...

gcc-14.1.1

FAILED: CMakeFiles/ot.dir/src/opus.cc.o 
/usr/bin/c++ -D_GNU_SOURCE -I/dev/shm/testbuild/spe/opustags/build -I/dev/shm/testbuild/spe/opustags/src -O3 -DNDEBUG -std=gnu++20 -I/usr/include -MD -MT CMakeFiles/ot.dir/src/opus.cc.o -MF CMakeFiles/ot.dir/src/opus.cc.o.d -o CMakeFiles/ot.dir/src/opus.cc.o -c /dev/shm/testbuild/spe/opustags/src/opus.cc
In file included from /dev/shm/testbuild/spe/opustags/src/opus.cc:24:
/dev/shm/testbuild/spe/opustags/src/opustags.h:127:54: warning: ignoring attributes on template argument ‘int (*)(FILE*)’ [-Wignored-attributes]
  127 | struct file : std::unique_ptr<FILE, decltype(&fclose)> {
      |                                                      ^
/dev/shm/testbuild/spe/opustags/src/opustags.h: In constructor ‘ot::file::file(FILE*)’:
/dev/shm/testbuild/spe/opustags/src/opustags.h:128:74: warning: ignoring attributes on template argument ‘int (*)(FILE*)’ [-Wignored-attributes]
  128 |         file(FILE* f = nullptr) : std::unique_ptr<FILE, decltype(&fclose)>(f, &fclose) {}
      |                                                                          ^
/dev/shm/testbuild/spe/opustags/src/opus.cc: In function ‘std::optional<ot::picture> ot::extract_cover(const opus_tags&)’:
/dev/shm/testbuild/spe/opustags/src/opus.cc:171:31: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
  171 |         auto cover_tag = std::find_if(tags.comments.begin(), tags.comments.end(), is_cover);
      |                               ^~~~~~~
      |                               find
/dev/shm/testbuild/spe/opustags/src/opus.cc:175:37: error: ‘find_if’ is not a member of ‘std’; did you mean ‘find’?
  175 |         auto extra_cover_tag = std::find_if(std::next(cover_tag), tags.comments.end(), is_cover);
      |                                     ^~~~~~~
      |                                     find
[3/8] Building CXX object CMakeFiles/ot.dir/src/cli.cc.o
FAILED: CMakeFiles/ot.dir/src/cli.cc.o 
/usr/bin/c++ -D_GNU_SOURCE -I/dev/shm/testbuild/spe/opustags/build -I/dev/shm/testbuild/spe/opustags/src -O3 -DNDEBUG -std=gnu++20 -I/usr/include -MD -MT CMakeFiles/ot.dir/src/cli.cc.o -MF CMakeFiles/ot.dir/src/cli.cc.o.d -o CMakeFiles/ot.dir/src/cli.cc.o -c /dev/shm/testbuild/spe/opustags/src/cli.cc
In file included from /dev/shm/testbuild/spe/opustags/src/cli.cc:9:
/dev/shm/testbuild/spe/opustags/src/opustags.h:127:54: warning: ignoring attributes on template argument ‘int (*)(FILE*)’ [-Wignored-attributes]
  127 | struct file : std::unique_ptr<FILE, decltype(&fclose)> {
      |                                                      ^
/dev/shm/testbuild/spe/opustags/src/opustags.h: In constructor ‘ot::file::file(FILE*)’:
/dev/shm/testbuild/spe/opustags/src/opustags.h:128:74: warning: ignoring attributes on template argument ‘int (*)(FILE*)’ [-Wignored-attributes]
  128 |         file(FILE* f = nullptr) : std::unique_ptr<FILE, decltype(&fclose)>(f, &fclose) {}
      |                                                                          ^
/dev/shm/testbuild/spe/opustags/src/cli.cc: In function ‘ot::options ot::parse_options(int, char**, FILE*)’:
/dev/shm/testbuild/spe/opustags/src/cli.cc:177:22: error: ‘transform’ is not a member of ‘std’
  177 |                 std::transform(local_to_add.begin(), local_to_add.end(),
      |                      ^~~~~~~~~
/dev/shm/testbuild/spe/opustags/src/cli.cc:179:22: error: ‘transform’ is not a member of ‘std’
  179 |                 std::transform(local_to_delete.begin(), local_to_delete.end(),
      |                      ^~~~~~~~~
/dev/shm/testbuild/spe/opustags/src/cli.cc:185:30: error: ‘transform’ is not a member of ‘std’
  185 |                         std::transform(local_to_add.begin(), local_to_add.end(),
      |                              ^~~~~~~~~
/dev/shm/testbuild/spe/opustags/src/cli.cc:187:30: error: ‘transform’ is not a member of ‘std’
  187 |                         std::transform(local_to_delete.begin(), local_to_delete.end(),
      |                              ^~~~~~~~~
/dev/shm/testbuild/spe/opustags/src/cli.cc: In function ‘std::u8string format_value(const std::u8string&, const ot::options&)’:
/dev/shm/testbuild/spe/opustags/src/cli.cc:243:35: error: ‘count’ is not a member of ‘std’; did you mean ‘popcount’?
  243 |         auto newline_count = std::count(source.begin(), source.end(), opt.tag_delimiter);
      |                                   ^~~~~
      |                                   popcount

Likely due to ArchLinux's recent upgrade to GCC 14.1.1
Version : Release 1.10.0

Improve --list

Checkboxes!

  • Make --list print colored output (make sure to include stream number)
  • Make the colors disableable with --no-colors option (pay extra attention to the naming in the manpage, maybe I've misspelled the name here)

Confront this with #6 . If we get information about all streams, maybe we should display sth like, Stream 1 of 3?

This probably requires #13.

Stream numbers

Man page reads:

The identifer of a stream is determined from its position in the file. The first Opus stream found will have id 1, the second 2, and so on. Non-Opus streams are not numbered.

You can select more than one stream with this option by separated id's with commas. For example: --stream 1,3. Ranges are not supported.

...but right now, the handlers receive streamno rather than sequential stream identifier. As such, running ./opustags test.ogg --export results in following:

[Stream -336916309]
LANGUAGE=und
HANDLER_NAME=SoundHandler
ENCODER=Lavc57.24.102 libopus
MAJOR_BRAND=isom
MINOR_VERSION=512
COMPATIBLE_BRANDS=isomiso2avc1mp41

which is not what the manpage promised.

I don't think maintaining sequential order should be handled by TagHandlers, cause it'll need to introduce duplicated code everywhere. I'd like to let actions.cc deal with this.

Croak when a handler wasn't called

Say you do --stream 2 --add TITLE=X. We've got two problematic cases:

  • Stream 2 doesn't exist.
  • Stream 2 isn't an Opus stream.

In both cases, the user should at least be warned.

Technically, in these scenarii, the ITagsHandler::list isn't called, which makes that kind of detection a bit less obvious: it should be done in ITagsHandler::end_of_file. For non-Opus streams, we detect the problem right from ITagsHandler::start_of_file which passes the type of the stream as a parameter.

need to explicitely include <optional>

Hi,

I am not able to build opustags as it fails during compilation because of

In file included from /home/op/build/opustags/src/cli.cc:10:
/home/op/build/opustags/src/opustags.h:390:7: error: no template named
      'optional' in namespace 'std'
        std::optional<std::string> path_out;
        ~~~~~^
...

I am not proficient in C++, so I'm not able to properly fix this, but if I add an explicit include in opustags, it builds fine.

Index: src/opustags.h
--- src/opustags.h.orig
+++ src/opustags.h
@@ -31,6 +31,7 @@
 #include <functional>
 #include <list>
 #include <memory>
+#include <optional>
 #include <string>
 #include <vector>

I'm using clang 10.0.1 on OpenBSD. Also, FYI to build here it also needs the target_link_libraries to iconv.

I've just fixed a bunch of tags on various ogg files, thanks for developing this :)

1 test fails: Illegal byte sequence

cd /usr/ports/audio/opustags/work/.build/t && prove /usr/ports/audio/opustags/work/.build/t /usr/ports/audio/opustags/work/opustags-1.8.0/t
/usr/ports/audio/opustags/work/.build/t/base64.t ............ ok
/usr/ports/audio/opustags/work/.build/t/cli.t ............... ok
/usr/ports/audio/opustags/work/.build/t/ogg.t ............... ok
/usr/ports/audio/opustags/work/.build/t/opus.t .............. ok
# unexpected error: Illegal byte sequence.
/usr/ports/audio/opustags/work/.build/t/system.t ............ 
Failed 1/4 subtests 
Can't locate List/MoreUtils.pm in @INC (you may need to install the List::MoreUtils module) (@INC contains: /usr/local/lib/perl5/site_perl/mach/5.32 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.32/mach /usr/local/lib/perl5/5.32) at /usr/ports/audio/opustags/work/opustags-1.8.0/t/opustags.t line 13.
BEGIN failed--compilation aborted at /usr/ports/audio/opustags/work/opustags-1.8.0/t/opustags.t line 13.
# Looks like your test exited with 2 before it could output anything.
/usr/ports/audio/opustags/work/opustags-1.8.0/t/opustags.t .. 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 59/59 subtests 

Test Summary Report
-------------------
/usr/ports/audio/opustags/work/.build/t/system.t          (Wstat: 0 Tests: 4 Failed: 1)
  Failed test:  3
/usr/ports/audio/opustags/work/opustags-1.8.0/t/opustags.t (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 59 tests but ran 0.
Files=6, Tests=21,  1 wallclock secs ( 0.05 usr  0.03 sys +  0.20 cusr  0.02 csys =  0.30 CPU)
Result: FAIL
ninja: build stopped: subcommand failed.

Version: 1.8.0
clang-14
FreeBSD 13.1

Temporary file \todo already done?

In cli.cc there is a comment:

  * \todo Use a safer temporary file name for in-place editing, like tmpnam.

But in system.cc, ot::partial_file::open already uses mkstemps to create the temporary file.

Let TagHandler know when all streams have been processed

There are a few ways to accomplish this:

  1. Create an event ITagsHandler::start_of_file(const int stream_count)
  2. Create an event ITagsHandler::end_of_file()
  3. Both?

In any case, I'd like to avoid introducing any kind of state to ITagsHandler and let StreamTagsHandler deal with state as a part of its implementation.

Implement --version / -V

Ideally, the build system should create a small distributable version.h with current git tag + revision.

Handle --stream multivalues

The recent change in the manpage, which was to my liking, introduces --stream=1,2 syntax. This should be implemented regardless of #4 to have something working.

Rather than making StreamTagsHandler more complex by adding std::vector<int> relevant_stream_numbers to its constructor, I'd like to add multiple TagsHandlers, each responsible for a single stream, during option parsing.

Please include usage examples

I have no idea how to e.g., $ opustag -a "CHAPTER000=00:08:20.940" ../If\ This\ Be\ Treason\ --\ Audiobook.opus

Please include some usage examples somewhere, either in the readme or somewhere related to this package so that it is easily locatable next time I need it.

--export and --import

For now, the export and import commands should use a syntax that identifies particular streams, even if the file contains only one stream.

Later we'll make this header optional for one stream only files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.