1 | --- a/mythtv/mythplugins/mythmusic/mythmusic/metaioid3.cpp 2012-05-25 07:28:27.008411827 +0930 |
---|
2 | +++ a/mythtv/mythplugins/mythmusic/mythmusic/metaioid3.cpp 2012-05-31 12:28:20.339743559 +0930 |
---|
3 | @@ -25,7 +25,6 @@ MetaIOID3::MetaIOID3(void) |
---|
4 | |
---|
5 | MetaIOID3::~MetaIOID3(void) |
---|
6 | { |
---|
7 | - CloseFile(); |
---|
8 | } |
---|
9 | |
---|
10 | /*! |
---|
11 | @@ -162,7 +162,10 @@ bool MetaIOID3::write(const Metadata* md |
---|
12 | TagLib::ID3v2::Tag *tag = GetID3v2Tag(); |
---|
13 | |
---|
14 | if (!tag) |
---|
15 | + { |
---|
16 | + CloseFile(); |
---|
17 | return false; |
---|
18 | + } |
---|
19 | |
---|
20 | WriteGenericMetadata(tag, mdata); |
---|
21 | |
---|
22 | @@ -221,8 +224,12 @@ bool MetaIOID3::write(const Metadata* md |
---|
23 | } |
---|
24 | |
---|
25 | if (!SaveFile()) |
---|
26 | + { |
---|
27 | + CloseFile(); |
---|
28 | return false; |
---|
29 | + } |
---|
30 | |
---|
31 | + CloseFile(); |
---|
32 | return true; |
---|
33 | } |
---|
34 | |
---|
35 | @@ -243,7 +250,10 @@ Metadata *MetaIOID3::read(const QString |
---|
36 | TagLib::ID3v1::Tag *tag_v1 = GetID3v1Tag(); |
---|
37 | |
---|
38 | if (!tag_v1) |
---|
39 | + { |
---|
40 | + CloseFile(); |
---|
41 | return NULL; |
---|
42 | + } |
---|
43 | |
---|
44 | if (!tag_v1->isEmpty()) |
---|
45 | { |
---|
46 | @@ -342,6 +352,7 @@ Metadata *MetaIOID3::read(const QString |
---|
47 | LOG(VB_FILE, LOG_DEBUG, |
---|
48 | QString("MetaIOID3::read: Length for '%1' from properties is '%2'\n").arg(filename).arg(metadata->Length())); |
---|
49 | |
---|
50 | + CloseFile(); |
---|
51 | return metadata; |
---|
52 | } |
---|
53 | |
---|
54 | @@ -399,10 +410,12 @@ QImage* MetaIOID3::getAlbumArt(const QSt |
---|
55 | { |
---|
56 | picture->loadFromData((const uchar *)frame->picture().data(), |
---|
57 | frame->picture().size()); |
---|
58 | + CloseFile(); |
---|
59 | return picture; |
---|
60 | } |
---|
61 | } |
---|
62 | } |
---|
63 | + CloseFile(); |
---|
64 | } |
---|
65 | |
---|
66 | delete picture; |
---|
67 | @@ -423,10 +436,14 @@ AlbumArtList MetaIOID3::getAlbumArtList( |
---|
68 | { |
---|
69 | TagLib::ID3v2::Tag *tag = GetID3v2Tag(); |
---|
70 | |
---|
71 | if (!tag) |
---|
72 | + { |
---|
73 | + CloseFile(); |
---|
74 | return imageList; |
---|
75 | + } |
---|
76 | |
---|
77 | imageList = readAlbumArt(tag); |
---|
78 | + CloseFile(); |
---|
79 | } |
---|
80 | |
---|
81 | return imageList; |
---|
82 | @@ -606,7 +624,10 @@ bool MetaIOID3::writeAlbumArt(const QStr |
---|
83 | TagLib::ID3v2::Tag *tag = GetID3v2Tag(); |
---|
84 | |
---|
85 | if (!tag) |
---|
86 | + { |
---|
87 | + CloseFile(); |
---|
88 | return false; |
---|
89 | + } |
---|
90 | |
---|
91 | AttachedPictureFrame *apic = findAPIC(tag, type, |
---|
92 | QStringToTString(albumart->description)); |
---|
93 | @@ -628,8 +649,12 @@ bool MetaIOID3::writeAlbumArt(const QStr |
---|
94 | apic->setDescription(QStringToTString(albumart->description)); |
---|
95 | |
---|
96 | if (!SaveFile()) |
---|
97 | + { |
---|
98 | + CloseFile(); |
---|
99 | return false; |
---|
100 | + } |
---|
101 | |
---|
102 | + CloseFile(); |
---|
103 | return true; |
---|
104 | } |
---|
105 | |
---|
106 | @@ -675,18 +700,28 @@ bool MetaIOID3::removeAlbumArt(const QSt |
---|
107 | TagLib::ID3v2::Tag *tag = GetID3v2Tag(); |
---|
108 | |
---|
109 | if (!tag) |
---|
110 | + { |
---|
111 | + CloseFile(); |
---|
112 | return false; |
---|
113 | + } |
---|
114 | |
---|
115 | AttachedPictureFrame *apic = findAPIC(tag, type, |
---|
116 | QStringToTString(albumart->description)); |
---|
117 | if (!apic) |
---|
118 | + { |
---|
119 | + CloseFile(); |
---|
120 | return false; |
---|
121 | + } |
---|
122 | |
---|
123 | tag->removeFrame(apic); |
---|
124 | |
---|
125 | if (!SaveFile()) |
---|
126 | + { |
---|
127 | + CloseFile(); |
---|
128 | return false; |
---|
129 | + } |
---|
130 | |
---|
131 | + CloseFile(); |
---|
132 | return true; |
---|
133 | } |
---|
134 | |
---|
135 | @@ -729,7 +764,10 @@ bool MetaIOID3::changeImageType(const QS |
---|
136 | TagLib::ID3v2::Tag *tag = GetID3v2Tag(); |
---|
137 | |
---|
138 | if (!tag) |
---|
139 | + { |
---|
140 | + CloseFile(); |
---|
141 | return false; |
---|
142 | + } |
---|
143 | |
---|
144 | AttachedPictureFrame *apic = findAPIC(tag, type, |
---|
145 | QStringToTString(albumart->description)); |
---|
146 | @@ -760,8 +798,12 @@ bool MetaIOID3::changeImageType(const QS |
---|
147 | } |
---|
148 | |
---|
149 | if (!SaveFile()) |
---|
150 | + { |
---|
151 | + CloseFile(); |
---|
152 | return false; |
---|
153 | + } |
---|
154 | |
---|
155 | + CloseFile(); |
---|
156 | return true; |
---|
157 | } |
---|
158 | |
---|
159 | @@ -840,13 +882,20 @@ bool MetaIOID3::writeVolatileMetadata(co |
---|
160 | TagLib::ID3v2::Tag *tag = GetID3v2Tag(); |
---|
161 | |
---|
162 | if (!tag) |
---|
163 | + { |
---|
164 | + CloseFile(); |
---|
165 | return false; |
---|
166 | + } |
---|
167 | |
---|
168 | bool result = (writeRating(tag, rating) && writePlayCount(tag, playcount)); |
---|
169 | |
---|
170 | if (!SaveFile()) |
---|
171 | + { |
---|
172 | + CloseFile(); |
---|
173 | return false; |
---|
174 | + } |
---|
175 | |
---|
176 | + CloseFile(); |
---|
177 | return result; |
---|
178 | } |
---|
179 | |
---|
180 | @@ -884,5 +933,7 @@ bool MetaIOID3::TagExists(const QString |
---|
181 | (v1_tag && !v1_tag->isEmpty())) |
---|
182 | retval = true; |
---|
183 | |
---|
184 | + CloseFile(); |
---|
185 | + |
---|
186 | return retval; |
---|
187 | } |
---|