[mythtv] Mythvideo and UTF8 filenames
Xavier Hervy
maxpower44 at tiscali.fr
Fri Jun 4 03:17:45 EDT 2004
Xavier Hervy wrote:
> Xavier Hervy wrote:
>
>> Xavier Hervy wrote:
>>
>>> Lutz Mändle wrote:
>>>
>>>> mythvideo 0.15.1 seems to have big problems with filenames in UTF-8
>>>> convention, I have video files with german umlauts in my collection
>>>> and their names are displayed incorrect in mythvideo, even it is
>>>> impossible to play them via mplayer.
>>>>
>>> Same problem.
>>> first at all, my /etc/sysconfig/i18n:
>>> LANG="fr_FR.UTF-8"
>>> SUPPORTED="fr_FR.UTF-8:fr_FR:fr"
>>> SYSFONT="latarcyrheb-sun16"
>>>
>>> My database is in latin1
>>>
>>> When i made in console :
>>> mysql mytconverg -e "select title from videometadata"
>>>
>>> it display : "La Mmoire dans la peau" instead of "La Mémoire dans la
>>> peau", and mythvideo display "La M moire dans la peau"
>>> if i correct it in database, then mythvideo display the good title.
>>>
>>> an other information, if i made auto imdb, the list of possible
>>> movies is shown with good characters.
>>> then the bad conversion should appeared when we store metadata in
>>> database.
>>>
>>> What can be interesting is to know who have trouble, with which config.
>>> And if those don't have problem, if they are special characters in
>>> metadata or not.
>>>
>>> xavier
>>>
>>
>> An other information :
>> in my database, i have "Français" in videocountry, but when i show it
>> with mysql command, i see "Franais" and in videofilter dialog i can
>> see "Français".
>> I i take a look of metadata.cpp, when inserting country in databse i
>> don't use QString::fromUtf8(), but for example title us it.
>> To resume, i suppose that those have problem with special characters
>> in metadata don't have with videofilter , andthose don't have trouble
>> with metadata, have in videofilter ...
>> How to do in order that all users are happy ?
>>
>
> Hi Lutz,
> can you try this patch and tell me if it's work for you ?
> For testing :
> - remove on movie in videometadata.
> - launch myth -> mythvideo -> video manager
> - tell me if filename and title look correct
> - then reset metadata
> - tell me if filename and title look correct
> - then grab from imdb
> - tell me if all text are correct.
> thx
>
> If someone else can try it, it'll sort myself out.
>
> Xavier
>
>
I forget the patch (just fortrying)
-------------- next part --------------
Index: mythvideo/mythvideo/main.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/main.cpp,v
retrieving revision 1.29
diff -u -r1.29 main.cpp
--- mythvideo/mythvideo/main.cpp 9 May 2004 22:53:26 -0000 1.29
+++ mythvideo/mythvideo/main.cpp 2 Jun 2004 20:12:20 -0000
@@ -432,6 +432,7 @@
}
QString filename = fi->absFilePath();
+ filename = filename.utf8();
if (fi->isDir())
BuildFileList(db, filename, video_files, imageExtensions);
else
Index: mythvideo/mythvideo/metadata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/metadata.cpp,v
retrieving revision 1.12
diff -u -r1.12 metadata.cpp
--- mythvideo/mythvideo/metadata.cpp 26 May 2004 19:58:03 -0000 1.12
+++ mythvideo/mythvideo/metadata.cpp 2 Jun 2004 20:12:20 -0000
@@ -110,7 +110,7 @@
if (query.isActive()){
if (query.numRowsAffected()>0){
query.next();
- category = query.value(0).toString();
+ category = QString::fromUtf8(query.value(0).toString());
}
}else{
cerr << "metadata.o : SELECT Failed : " << thequery << endl;
@@ -128,7 +128,7 @@
genres.clear();
if (query.isActive() && query.numRowsAffected()>1){
while(query.next()){
- genres.append(query.value(0).toString());
+ genres.append(QString::fromUtf8(query.value(0).toString()));
}
}
}
@@ -144,7 +144,7 @@
countries.clear();
if (query.isActive() && query.numRowsAffected()>1){
while(query.next()){
- genres.append(query.value(0).toString());
+ genres.append(QString::fromUtf8(query.value(0).toString()));
}
}
@@ -225,7 +225,7 @@
childID = query.value(11).toUInt();
browse = query.value(12).toBool();
playcommand = query.value(13).toString();
- category = query.value(14).toString();
+ category = QString::fromUtf8(query.value(14).toString());
// Genres
fillGenres(db);
@@ -278,7 +278,7 @@
"coverfile,inetref,browse) VALUES "
"(\"%s\",\"%s\",\"%s\",\"%s\",%d,%f,%d,\"%s\",%d,\"%s\","
"\"%s\", %d);",
- title.utf8().data(), director.utf8().data(),
+ QString::fromUtf8(title).utf8().data(), director.utf8().data(),
plot.utf8().data(), rating.utf8().data(), year,
userrating, length, sqlfilename.utf8().data(), showlevel,
sqlcoverfile.utf8().data(), inetref.utf8().data(),browse);
@@ -294,7 +294,8 @@
void Metadata::guessTitle()
{
- title = filename.right(filename.length() - filename.findRev("/") - 1);
+ QString tmp = filename.utf8();
+ title = tmp.right(tmp.length() - tmp.findRev("/") - 1);
title.replace(QRegExp("_"), " ");
title.replace(QRegExp("%20"), " ");
title = title.left(title.findRev("."));
@@ -338,7 +339,8 @@
plot.replace(QRegExp("\""), QString("\\\""));
rating.replace(QRegExp("\""), QString("\\\""));
playcommand.replace(QRegExp("\""), QString("\\\""));
- QString sqlfilename = filename;
+ QString sqlfilename = filename.utf8();
+
sqlfilename.replace(QRegExp("\""), QString("\\\""));
QString sqlcoverfile = coverfile;
Index: mythvideo/mythvideo/videofilter.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videofilter.cpp,v
retrieving revision 1.2
diff -u -r1.2 videofilter.cpp
--- mythvideo/mythvideo/videofilter.cpp 24 May 2004 01:19:11 -0000 1.2
+++ mythvideo/mythvideo/videofilter.cpp 2 Jun 2004 20:12:28 -0000
@@ -238,7 +238,7 @@
while (a_query.next())
{
category_select->addItem(a_query.value(0).toInt(),
- a_query.value(1).toString());
+ QString::fromUtf8(a_query.value(1).toString()));
}
}
category_select->addItem(0,tr("Unknown"));
@@ -258,7 +258,7 @@
{
while (a_query.next())
{
- genre_select->addItem(a_query.value(0).toInt() ,a_query.value(1).toString());
+ genre_select->addItem(a_query.value(0).toInt() ,QString::fromUtf8(a_query.value(1).toString()));
}
}
genre_select->addItem(0,tr("Unknown"));
@@ -277,7 +277,7 @@
{
while(a_query.next())
{
- country_select->addItem(a_query.value(0).toInt(),a_query.value(1).toString());
+ country_select->addItem(a_query.value(0).toInt(),QString::fromUtf8(a_query.value(1).toString()));
}
}
country_select->addItem(0,tr("Unknown"));
Index: mythvideo/mythvideo/videomanager.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videomanager.cpp,v
retrieving revision 1.31
diff -u -r1.31 videomanager.cpp
--- mythvideo/mythvideo/videomanager.cpp 22 May 2004 19:31:42 -0000 1.31
+++ mythvideo/mythvideo/videomanager.cpp 2 Jun 2004 20:12:32 -0000
@@ -485,8 +485,9 @@
while (true) {
while (proc.canReadLineStdout() || proc.canReadLineStderr()) {
if (proc.canReadLineStdout()) {
- ret += QString::fromLocal8Bit(proc.readLineStdout(),-1) + "\n";
- }
+ // ret += QString::fromLocal8Bit(proc.readLineStdout(),-1) + "test\n";
+ ret += proc.readLineStdout() + "\n";
+ }
if (proc.canReadLineStderr()) {
if (err == "") err = cmd + ": ";
err += QString::fromLocal8Bit(proc.readLineStderr(),-1) + "\n";
@@ -510,7 +511,9 @@
while (proc.canReadLineStdout() || proc.canReadLineStderr()) {
if (proc.canReadLineStdout()) {
- ret += QString::fromLocal8Bit(proc.readLineStdout(),-1) + "\n";
+// ret += QString::fromLocal8Bit(proc.readLineStdout(),-1) + "\n";
+ ret += QString::fromUtf8(proc.readLineStdout()+"test",-1) + "\n";
+//ret += proc.readLineStdout().utf8() + "\n";
}
if (proc.canReadLineStderr()) {
if (err == "") err = cmd + ": ";
@@ -529,6 +532,7 @@
ret = "#ERROR";
}
VERBOSE(VB_ALL, ret);
+
return ret;
}
@@ -552,7 +556,7 @@
// parse results
movieList.clear();
int count = 0;
- QStringList lines = QStringList::split('\n', results);
+ QStringList lines = QStringList::split('\n', QString::fromUtf8(results,-1));
for (QStringList::Iterator it = lines.begin();it != lines.end(); ++it) {
if ( (*it).at(0) == '#') // treat lines beg w/ # as a comment
continue;
@@ -833,6 +837,7 @@
if (m_list.count() > 0 && curitem)
{
+
QString title = curitem->Title();
QString filename = curitem->Filename();
QString director = curitem->Director();
@@ -1387,7 +1392,6 @@
void VideoManager::ResetCurrentItem()
{
QString coverFile = tr("No Cover");
-
curitem->guessTitle();
curitem->setCoverFile(coverFile);
curitem->setYear(1895);
@@ -1653,7 +1657,6 @@
void VideoManager::slotResetMeta()
{
cancelPopup();
-
ResetCurrentItem();
QString movieCoverFile = GetMoviePoster(QString("Local"));
if (movieCoverFile != "<NULL>")
More information about the mythtv-dev
mailing list