Database structure has changed once more?
#16
EDIT --- duplicated post, please delete
Reply
#17
Note that the export to XML brings other benefits which is why I bothered doing it: It's a text based format that can be altered more easily if one doesn't know SQL, and (more importantly) it's independent of the database layout, and can thus be used to transistion to a new, shinier schema.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#18
Thumbs Up 
jmarshall Wrote:Note that the export to XML brings other benefits which is why I bothered doing it: It's a text based format that can be altered more easily if one doesn't know SQL, and (more importantly) it's independent of the database layout, and can thus be used to transistion to a new, shinier schema.
That's a very good point.
I started using MySQL as XBMC database server a couple of weeks ago, so backing up raw db files is not an option for me, but I mentioned anyway its pros and cons because I think it's still a good alternative for people using SQLite (off course before the great db redesign) Smile

Is there any chance to include file settings(like zoom level, aspect ratio, etc.) in the exported XML? IMHO with that addition the export/import functionality would be almost perfect.
Reply
#19
Quote:Is there any chance to include file settings(like zoom level, aspect ratio, etc.) in the exported XML? IMHO with that addition the export/import functionality would be almost perfect.

Sure - I just haven't been arsed doing it as yet. A patch would be most welcome if you're that way inclined. Smile

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#20
jmarshall Wrote:Sure - I just haven't been arsed doing it as yet. A patch would be most welcome if you're that way inclined. Smile
Cheers,
Jonathan
Thanks, but C++ is not my poison...
I barely know my way through C++ code.
But if it helps I can bring the beers Smile
Reply
#21
.NET Huh

that evil poison we stay far far away from. xbmc runs on bare metal.
Reply
#22
spiff Wrote:.NET Huh

that evil poison we stay far far away from. xbmc runs on bare metal.

You see, I can't program in a language that doesn't even exist...Smile
Reply
#23
jmarshall Wrote:Sure - I just haven't been arsed doing it as yet. A patch would be most welcome if you're that way inclined. Smile
Well, I've drunk the beers, and I'm trying to make the modifications myself (using my very poor knowledge of C++):
-Added a call to the function GetVideoSettings, inside GetDetailsForMovie, and modified CVideoInfoTag class adding CVideoSettings m_settings at the end of the public section.
-Modified the CVideoInfoTag::Save function to save a few new tags with file settings info:
Code:
TiXmlElement filesettings("filesettings");
    XMLUtils::SetInt(&filesettings, "interleaved", m_settings.m_InterlaceMethod);
    XMLUtils::SetInt(&filesettings, "viewmode", m_settings.m_ViewMode);
    XMLUtils::SetFloat(&filesettings, "zoomamount", m_settings.m_CustomZoomAmount);
    XMLUtils::SetFloat(&filesettings, "pixelratio", m_settings.m_CustomPixelRatio);
    movie->InsertEndChild(filesettings);
The problem I'm having is that it seems that the dataset m_pDS opened inside CVideoDatabase::ExportToXML function is being closed after I call GetVideoSettings. So it only grabs the info of the first movie.
At first I though the problem was that the same dataset that is used in ExportToXML is the one used by GetVideoSettings, so I defined a new one and changed it in GetVideoSettings, and I did the same in GetFileId that is called from GetVideoSettings, but I still have the same problem.
Any ideas on how to solve it?
Reply
#24
You've got the right basic idea, but it's complicated somewhat by all the settings we have and how they're linked up - settings apply to files not just library files. I suspect it may be more useful just to dump out all the settings in a different block so that we ensure we dump them for files not in the main library.

Basically you'd just iterate through the settings table separately and dump out filename+path and the settings into an XML block. eg something like:

<settings>
<file path="full path here">
<interleaved></interleaved>
...
</file>
</settings>

or something.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#25
charrua, thanks a lot for contributing to this. It's really appreciated. At least by me. Smile
Reply
#26
jmarshall Wrote:You've got the right basic idea, but it's complicated somewhat by all the settings we have and how they're linked up - settings apply to files not just library files. I suspect it may be more useful just to dump out all the settings in a different block so that we ensure we dump them for files not in the main library.
Basically you'd just iterate through the settings table separately and dump out filename+path and the settings into an XML block. eg something like:
<settings>
<file path="full path here">
<interleaved></interleaved>
...
</file>
</settings>
or something.
Thanks for the tip jmarshall, I understand that file settings are being stored for all video files and not just the ones in the library, but at least for me it's not important to save the setting for files not in the library, there maybe items in the settings table that are long gone from my disk so I'm not so sure if it is a good idea to just export all the settings.
Anyway the problem that I'm having right now is that the dataset m_pDS opened inside CVideoDatabase::ExportToXML function is being closed after I call GetVideoSettings. So it only grabs the info of the first movie being exported. Any ideas on how to solve that? Thanks again for your help.

ashlar Wrote:charrua, thanks a lot for contributing to this. It's really appreciated. At least by me. Smile
Thanks ashlar, no problem at all. I'm glad to help and learn a bit in the process Wink
Reply
#27
change the function to use m_pDS2 IF it is safe. if not, you have to use a new dataset.
Reply
#28
spiff Wrote:change the function to use m_pDS2 IF it is safe. if not, you have to use a new dataset.
Thanks spiff, I already tried both: first used m_pDS, then m_pDS2 and then defined m_pDS3 and m_pDS4 to also change the dataset used in GetFileId that is called from GetVideoSettings, but I'm still having the same problem...
Reply
#29
afaict from a *brief* look, you need to change GetPathId(), GetFileId() and GetVideoSettings(). it's highly sensitive code though, as those are possibly called elsewhere where we rely on them not touching m_pDS2.
Reply
#30
spiff Wrote:afaict from a *brief* look, you need to change GetPathId(), GetFileId() and GetVideoSettings(). it's highly sensitive code though, as those are possibly called elsewhere where we rely on them not touching m_pDS2.
Thanks again spiff! The problem was in GetPathId(), I didn't see the call from GetFileID() to that function, I used new datasets for each one so there's not danger of touching m_pDS and m_pDS2 by mistake.
Reply

Logout Mark Read Team Forum Stats Members Help
Database structure has changed once more?0