This class extends Frame to provide support ID3v2 Url Link Frames (Section 4.3.1), covering "W000" to "WZZZ", excluding "WXXX".

With these frames dynamic data such as webpages with touring information, price information or plain ordinary news can be added to the tag. There may only be one URL [URL] link frame of its kind in an tag, except when stated otherwise in the frame description. If the text string is followed by a string termination, all the following information should be ignored and not be displayed.

The following table contains types and descriptions as found in the ID3 2.4.0 native frames specification. (Copyright (C) Martin Nilsson 2000.)

ID Description WCOM The 'Commercial information' frame is a URL pointing at a webpage with information such as where the album can be bought. There may be more than one "WCOM" frame in a tag, but not with the same content. WCOP The 'Copyright/Legal information' frame is a URL pointing at a webpage where the terms of use and ownership of the file is described. WOAF The 'Official audio file webpage' frame is a URL pointing at a file specific webpage. WOAR The 'Official artist/performer webpage' frame is a URL pointing at the artists official webpage. There may be more than one "WOAR" frame in a tag if the audio contains more than one performer, but not with the same content. WOAS The 'Official audio source webpage' frame is a URL pointing at the official webpage for the source of the audio file, e.g. a movie. WORS The 'Official Internet radio station homepage' contains a URL pointing at the homepage of the internet radio station. WPAY The 'Payment' frame is a URL pointing at a webpage that will handle the process of paying for this file. WPUB The 'Publishers official webpage' frame is a URL pointing at the official webpage for the publisher.
Inheritance: TagLib.Id3v2.Frame
Esempio n. 1
0
        public static UrlLinkFrame Get(Tag tag, ByteVector ident, bool create)
        {
            if (tag == null)
            {
                throw new ArgumentNullException("tag");
            }
            if (ident == null)
            {
                throw new ArgumentNullException("ident");
            }
            if (ident.Count != 4)
            {
                throw new ArgumentException("Identifier must be four bytes long.", "ident");
            }
            foreach (UrlLinkFrame frame in tag.GetFrames <UrlLinkFrame>(ident))
            {
                return(frame);
            }
            if (!create)
            {
                return(null);
            }
            UrlLinkFrame new_frame = new UrlLinkFrame(ident);

            tag.AddFrame(new_frame);
            return(new_frame);
        }
Esempio n. 2
0
        public override Frame Clone()
        {
            UrlLinkFrame frame = (this is UserUrlLinkFrame)?new UserUrlLinkFrame(null, encoding):new UrlLinkFrame(FrameId);

            frame.text_fields = (string[])text_fields.Clone();
            if (raw_data != null)
            {
                frame.raw_data = new ByteVector(raw_data);
            }
            frame.raw_version = raw_version;
            return(frame);
        }
Esempio n. 3
0
        public string GetTextAsString(ByteVector ident)
        {
            Frame frame;

            if (ident[0] == 'W')
            {
                frame = UrlLinkFrame.Get(this, ident, false);
            }
            else
            {
                frame = TextInformationFrame.Get(this, ident, false);
            }
            string result = frame == null?null:frame.ToString();

            return(string.IsNullOrEmpty(result)?null:result);
        }
Esempio n. 4
0
        public void SetTextFrame(ByteVector ident, params string[] text)
        {
            if (ident == null)
            {
                throw new ArgumentNullException("ident");
            }
            if (ident.Count != 4)
            {
                throw new ArgumentException("Identifier must be four bytes long.", "ident");
            }
            bool empty = true;

            if (text != null)
            {
                for (int i = 0; empty && i < text.Length; i++)
                {
                    if (!string.IsNullOrEmpty(text[i]))
                    {
                        empty = false;
                    }
                }
            }
            if (empty)
            {
                RemoveFrames(ident);
                return;
            }
            if (ident[0] == 'W')
            {
                UrlLinkFrame urlFrame = UrlLinkFrame.Get(this, ident, true);
                urlFrame.Text         = text;
                urlFrame.TextEncoding = DefaultEncoding;
                return;
            }
            TextInformationFrame frame = TextInformationFrame.Get(this, ident, true);

            frame.Text         = text;
            frame.TextEncoding = DefaultEncoding;
        }
        /// <summary>
        ///    Gets a <see cref="UrlLinkFrame" /> object of a
        ///    specified type from a specified tag, optionally creating
        ///    and adding one with a specified encoding if none is
        ///    found.
        /// </summary>
        /// <param name="tag">
        ///    A <see cref="Tag" /> object to search for the specified
        ///    tag in.
        /// </param>
        /// <param name="ident">
        ///    A <see cref="ByteVector" /> object containing the frame
        ///    identifer to search for.
        /// </param>
        /// <param name="encoding">
        ///    A <see cref="StringType" /> value specifying the encoding
        ///    to use if a new frame is created.
        /// </param>
        /// <param name="create">
        ///    A <see cref="bool" /> value specifying whether or not to
        ///    create a new frame if an existing frame was not found.
        /// </param>
        /// <returns>
        ///    A <see cref="UrlLinkFrame" /> object containing
        ///    the frame found in or added to <paramref name="tag" /> or
        ///    <see langword="null" /> if no value was found <paramref
        ///    name="create" /> is <see langword="false" />.
        /// </returns>
        /// <remarks>
        ///    To create a frame without having to specify the encoding,
        ///    use <see cref="Get(Tag,ByteVector,bool)" />.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="tag" /> or <paramref name="type" /> is
        ///    <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///    <paramref name="type" /> is not exactly four bytes long.
        /// </exception>
        public static UrlLinkFrame Get(Tag tag,
                                            ByteVector ident,
                                            StringType encoding,
                                            bool create)
        {
            if (tag == null)
            throw new ArgumentNullException("tag");

              if (ident == null)
            throw new ArgumentNullException("ident");

              if (ident.Count != 4)
            throw new ArgumentException(
              "Identifier must be four bytes long.",
              "ident");

              foreach (UrlLinkFrame frame in
            tag.GetFrames<UrlLinkFrame>(ident))
            return frame;

              if (!create)
            return null;

              UrlLinkFrame new_frame =
            new UrlLinkFrame(ident, encoding);
              tag.AddFrame(new_frame);
              return new_frame;
        }