1.. _EditingTags:
2
3Editing Tags
4============
5
6.. image:: ../images/tagedit.png
7    :scale: 45%
8    :align: right
9
10You can edit a song's tags by right clicking on it and selecting *Edit Tags*.
11
12In addition to manually entering the tags, if the song's filename contains
13information about all or some of the tags, you can use the *Edit tags from
14path* tab to populate these tags automatically. Please see
15:ref:`editing tags from path <tags-from-path>` below describing the
16process for several songs (the process is the same).
17
18
19Editing tags for several songs at once
20--------------------------------------
21
22To edit tags for several songs at once, select those songs (using Ctrl or
23Shift), then right click and "Edit Tags".
24
25Note that in the tag-editing window that opens, you have several tabs
26available. The default *Edit tags* tab will apply the same tags to all
27marked songs, so it only makes sense for tags that are common to all songs,
28e.g. album or genre. However, the tabs *Tags from Path* and *Track Numbers*
29let you edit tags that differ across songs:
30
31.. _tags-from-path:
32
33
34Editing tags from path
35^^^^^^^^^^^^^^^^^^^^^^
36
37The tab *Tags from Path* lets you batch edit tags that differ across songs,
38such as title, by using the filename as input. Note that you can customize
39the pattern that the tag editor uses to extract the tags from the filename:
40just imitate the pattern you see for your files, putting the relevant tag
41name in angular brackets.
42
43Example:
44
45 * Your file names have a pattern like this:
46   ``01 - The Beatles - Yellow Submarine.ogg``
47 * Edit the pattern to show: ``<tracknumber> - <artist> - <title>``
48 * Note that you can omit the file extension in your pattern.
49 * Click on *Preview* to see how your pattern would be interpreted for
50   each song.
51
52The preview is shown to the right of the current value; you may have to
53scroll right to see it.
54
55You can even include information from the entire path in this pattern
56matching:
57
58 * You have files like this
59   ``~/home/username/music/favourites/the_beatles/yellow_submarine/01 - Yellow Submarine.ogg``
60 * Use pattern: ``<artist>/<album>/<tracknumber> - <title>``
61 * In that case, you probably want to check the boxes for
62   *Replace underscores with spaces* and *Title-case tags*.
63 * Note that QL automatically digs as far upwards in the folder hierarchy as
64   it needs to given the pattern you put in, so you don't need to enter any
65   (potentially complex) folder structure that is above the needed info.
66
67You can see recent patterns you used by clicking on the drop down arrow to
68the right of the pattern input field. Additionally, clicking on *Edit saved
69values* in the drop-down that opens will let you save patterns and
70optionally name them. Use this for patterns that you apply frequently. If
71you leave the *Name* field blank for your pattern, the name will be
72identical to the pattern.
73
74
75Batch edit track numbers
76^^^^^^^^^^^^^^^^^^^^^^^^
77
78The *Track Numbers* tab in the tag editing window lets you batch edit track
79numbers ascending across the files. If your files are in the correct order,
80you simply check that you like the *Start from* and *Total tracks* values.
81If you put in any value greater than one for *Total tracks*, QL will use a
82tracknumber pattern `tracknumber/totaltracks`, e.g. ``2/12`` for *Total
83tracks* = ``12``. If you only want a single number for the track number,
84set *Total tracks* to zero.
85
86If your files are not in the correct order, for example because they are
87sorted alphabetically, you can drag and drop them into the desired order in
88the *File* field inside the *Track numbers* tab of the tag editing window
89before (optionally) clicking preview and then save.
90
91
92Rename Files Based on Tags
93--------------------------
94
95QL also lets you rename the files of songs based on tags, either for one
96song or for several songs. Edit patterns the same way you would for *Edit
97tags from path* (see above). This feature even lets you move them to a
98different directory; for more info see the :ref:`renaming files
99guide <RenamingFiles>`.
100
101Splitting Tags
102--------------
103
104If a tag contains a value that can be regarded as multiple tag values, it is
105often possible to split the tag. This can be done by right-clicking on the tag
106and then selecting the appropriate split in the ``Split Tag`` menu.
107
108There are in general two types of tag splitting possible: splitting on a single
109character and *subtag* splitting (extracting values in enclosures). The
110separating characters for both can be configured in the *Tags* tab in the
111preferences.
112
113Splitting on a single character - like ``,`` or ``&`` - will split a tag into
114multiple tags of the same type, but with different values. An example of this
115can be an artist tag with the value ``Foo, Bar``, that can be split into two
116separate tags *artist* = ``Foo`` and *artist* = ``Bar``.
117
118With *subtag* splitting, the end of the tag value must contain a value enclosed
119in some pair of characters - like ``()`` or ``[]``. Depending on the type of
120tag, the enclosed value can then be extracted and put in a new tag. An example
121of this can be an album tag with the value ``Album (CD 1)``, which can be split
122into *album* = ``Album`` and *discnumber* = ``1``. The enclosure can also
123contain multiple values separated by a single-character separator as explained
124above, like *artist* = ``Foo (Bar, Baz)``, which can be split into *artist* =
125``Foo``, *performer* = ``Bar`` and *performer* = ``Baz``.
126