Comments (5)
Not quite sure I understand the issue. Can you post an example file and some code so that we can reproduce your issue?
Note: the library function ReadFrom
returns the error (https://github.com/dhowden/tag/blob/master/tag.go#L25 ErrNoTagsFound
) here: https://github.com/dhowden/tag/blob/master/tag.go#L61.
The tag
tool is printing the returned error (in your case ErrNoTagsFound
) with some context and a trailing newline here: https://github.com/dhowden/tag/blob/master/cmd/tag/main.go#L48.
If you're using the library you should get back ErrNoTagsFound
, not the extended form printed out by the tag
tool.
from tag.
It takes a special file to duplicate it. I have several, but they contain copyrighted music so I do not want to post them.
The file is an MP3 file with no tags in it. I don't know how it was created.
If you run the file against the source built from the github link, you get the error message displayed, it is not trapped
./bugs Sweet_Darlin_Heart.mp3
no tags found
Run it thru your cmd/tag works as expected, gives a complete error
$ tag -raw Sweet_Darlin_Heart.mp3
error reading file: no tags found
I can share a file with the developers with the understanding that no intention is made to violate the copyright.
This program will exercise the issue.
The issue is that the library does not return the error, but instead it writes the error message directly to stdout.
Source code on github at
https://github.com/pfarrell51/gows/blob/master/music/tagtool/bugs/main.go
This is a simple, 35 line program with error traps. Under 5 lines actually reproducing the issue
Send me an email and I'll give you a mp3 file that breaks it
from tag.
I wrote a simple program to try this out:
package main
import (
"flag"
"log"
"os"
"github.com/dhowden/tag"
)
var path = flag.String("path", "", "`path` to file to check")
func main() {
flag.Parse()
f, err := os.Open(*path)
if err != nil {
log.Fatalf("Could not open: %v", err)
}
m, err := tag.ReadFrom(f)
if err != nil {
log.Fatalf("Error from ReadFrom: %v", err)
}
log.Printf("Tags: %v", m)
}
When run it outputs:
$ ./check-single -path example.mp3
2023/03/15 19:22:44 Error from ReadFrom: no tags found
Not sure what you mean here:
The issue is that the library does not return the error, but instead it writes the error message directly to stdout.
I only get the output from the log.Fatalf("Error from ReadFrom: %v", err)
statement, I don't see two no tags found
messages (one written out by the ReadFrom
, and one from the log stmt).
At this point I realised I missed that you had also posted an example program (thanks - always easier to reproduce with an example!), so also tried that (with some slight modifications to concentrate on the idea of testing if ReadFrom writes out the error to stdout instead of returning it):
package main
import (
"fmt"
"os"
"github.com/dhowden/tag"
)
func main() {
if len(os.Args) == 1 {
fmt.Println("Usage, bugs [filespec]")
return
}
arg := os.Args[1]
if arg == "" {
fmt.Println("PIB, input path empty")
return
}
file, err := os.Open(arg)
if err != nil {
fmt.Printf("err : %v %s\n", err, arg)
return
}
defer file.Close()
m, err := tag.ReadFrom(file)
if err != nil {
// Deliberately don't print anything. If the lilbrary is printing
// the error we should see it.
// fmt.Printf("%v", err)
return
}
if m == nil {
fmt.Printf("tag.ReadFrom (file) turned nil but no error for %s\n", arg)
}
fmt.Println("Got to the end") // Print this if we get to the end
}
With this program, I get no output from the example mp3 file which also seems to suggest that ReadFrom
is passing the error back, not writing it out to stdout:
$ ./bugs sample.mp3
Can you check that you are using a clean checkout of the library?
from tag.
from tag.
No issue here. User error in calling library.
from tag.
Related Issues (20)
- Support MP4 tags that are not mean `com.apple.iTunes`
- [Feature Request] Convert genre byte codes (including "Winamp Extension" codes 80-191) to string values HOT 1
- Feature Request: Writing Tags HOT 1
- error reading file: expected 'vorbis' identification type 1 with Ogg Opus file HOT 3
- OOM on malformed input
- Please WebM support HOT 1
- Error in Cover Art extraction HOT 1
- panic: runtime error: slice bounds out of range [:3] with capacity 1 HOT 1
- some vulnerability - 0x01 an out-of-bound vulnerability in readPICFrame function HOT 3
- some vulnerability - 0x02 an out-of-bound vulnerability in readAtomData function
- some vulnerability - 0x03 an out-of-bound vulnerability in readTextWithDescrFrame function HOT 7
- some vulnerability - 0x04 an out-of-bound vulnerability in readAPICFrame function
- Installation instructions in README are outdated ("go get" is deprecated) HOT 4
- panic: invalid encoding: expected even number of bytes for UTF-16 encoded text HOT 4
- [FEAT req] Pass on cli flags to only output selected metadata
- Why does metadataVorbis#Composer and #Artist return a value that was unasked for? HOT 1
- why my video always parse noting! HOT 2
- Sum changes when mp3 tag metadata changes HOT 10
- [FR] APE and WV (WavPack) support?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tag.