Giter Club home page Giter Club logo

outcastid3's People

Contributors

hendx avatar marcelmendesfilho avatar michaeljberk avatar ncrusher74 avatar normand1 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

outcastid3's Issues

Wrong length zero bytes for UTF-8 encoding strings

Data+String.swift
in case when comment have encoding .utf8 and we looking for zero bytes end of string we must wait ONE zero byte not two

two zero bytes only for UTF16

// unicode strings are terminated by \0\0, while latin terminated by \0
your comment is wrong only utf16 strinds are termonated by \0\0

http://id3.org/id3v2.4.0-structure
Frames that allow different types of text encoding contains a text
encoding description byte. Possible encodings:

 $00   ISO-8859-1 [ISO-8859-1]. Terminated with $00.
 $01   UTF-16 [UTF-16] encoded Unicode [UNICODE] with BOM. All
       strings in the same frame SHALL have the same byteorder.
       Terminated with $00 00.
 $02   UTF-16BE [UTF-16] encoded Unicode [UNICODE] without BOM.
       Terminated with $00 00.
 $03   UTF-8 [UTF-8] encoded Unicode [UNICODE]. Terminated with $00.

Transcription and Comment frame encoding

I'm having an interesting issue with the Transcription and Comment frames. When I write them using this code:

            OutcastID3.Frame.CommentFrame(
                encoding: .utf8, language: "eng",
                commentDescription: "description",
                comment: "Comment Test"),
            OutcastID3.Frame.TranscriptionFrame(
                encoding: .utf8, language: "eng",
                lyricsDescription: "description",
                lyrics: "Lyrics Test")

And run this test:

            // ... test on StringFrame types
            } else if let isolatedFrame = frame as? OutcastID3.Frame.CommentFrame {
                XCTAssertEqual(isolatedFrame.language, "eng")
                XCTAssertEqual(isolatedFrame.commentDescription, "description")
                XCTAssertEqual(isolatedFrame.comment, "Comment Test")
            } else if let isolatedFrame = frame as? OutcastID3.Frame.TranscriptionFrame {
                XCTAssertEqual(isolatedFrame.language, "eng")
                XCTAssertEqual(isolatedFrame.lyricsDescription, "description")
                XCTAssertEqual(isolatedFrame.lyrics, "Lyrics Test")
            }

This is the result I see:

Screen Shot 2020-03-08 at 3 36 22 PM

And the reason I'm including that as a screenshot is because when I try to cut/paste the test of the error, my posts on GitHub get cut off, because this is the actual text:

Screen Shot 2020-03-08 at 3 44 13 PM

and GitHub apparently doesn't like that extra character at the beginning.

I've tried every kind of encoding I can think of and none of them improve the result. And that doesn't explain why the content of the TranscriptionFrame is being written to the CommentFrame.

It also looks like OutcastID3 may be having an issue with adding characters to tags written by other writers. This is what happens when I try to read a file written using ID3TagEditor with OutcastID3:

        for frame in outcastFrames {
            if let isolatedFrame = frame as? OutcastID3.Frame.StringFrame {
                if isolatedFrame.type == AudiobookTag.authors.outcastType {
                    XCTAssertEqual(isolatedFrame.str, "Artist")
                    print((isolatedFrame.str).unicodeScalars.map({ $0.value }))
                    print("Artist".unicodeScalars.map({ $0.value }))
                    }
                }
            }
        let id3TagEditor = ID3TagEditor()
        if let id3Tag = try id3TagEditor.read(from: Bundle.testMp3FullMeta.path) {
            print((id3Tag.frames[.Artist] as? ID3FrameWithStringContent)?.content.unicodeScalars.map({ $0.value }))

        }

^^^ this test gets me this result:

/OutcastID3Tests.swift:26: error: -[AudiobookTaggerTests.OutcastID3Tests testMP3AudiobookTag] : 
XCTAssertEqual failed: ("Artist[X*]") is not equal to ("Artist")
[65, 114, 116, 105, 115, 116, 0]
[65, 114, 116, 105, 115, 116]
Optional([65, 114, 116, 105, 115, 116])

note*: X marks the extra character I removed so that the post wouldn't get cut off.

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.