Terminus Logo  Secured by phpPhobos

Shadow Family   
  Login  - No Account?  Create One   
Search 
Friday, 19 April 2024  -
News FeedRSS Feed
rss rdf  
  Home 
  Authentication 
 Documentation 
    Site Documentation 
    About me 
  Legal Notice 
 Applications 
    Web Links 
 Hobbies 
    RC Models 
    RC Batteries 
    Build blogs 
 Modules 
    Downloads 
    Weblinks 
 Blacklists 
    Blacklist 
    Blockout 
    DNS Blacklist 
 Registered Bloggers 
  Joerg's Blog 
 Gallery [Listing]
  > Diving 
  > Steampunk 
  > RC Planes 
  > FPV Drones 
  > Indy travels 
 FAQ  [ Topics  ]
 Common Linux problem... 
 Routerboard RBxxxAH 
 Apple Mac-mini 
 PHP Phobos 
 Stargate's Backup sc... 
 eBook Reader / PRS-5... 
 RC Models 
 Server in SolLan 
Terminus's FAQ   [  Topics  | Groups  | Last  | Expand  | Search  | Print  | Documentation ]
Folder open  Nothing Specific [ Expand ]
  Question ?  Is there a way to migrate playcount data from amarok to xbmc ?   
  Question ?  What is the Gnu Public Licence   
  Question ?  What does the name SOLSYS stand for ?   
  Question ?  What is a Kibit ? Or why does my OS show me less space than the manufacturer of the Disk ?   
spacer line
Folder open  Answers
spacer line
Question ? Is there a way to migrate playcount data from amarok to xbmc ?   [
View DetailsView details
|
Print ViewPrint view
]

 It is indeed possible to do this. However - the following will be required:

  • XBMC must use the MySQL database setup
  • Amarok must use the same Mysql DB xbmc is using
  • the xbmc user has SELECT rights to the amarokdb.
  • On the amarokdb - we have to crate a new view
  • You are using the same media repository on both sides, means both amarok and xbmc will read the mp3 tags out of the same files.

If these requirements are met - migrating the data over from Amarok to xbmc is possible.

Note - the following examples are working on Amarok 2.7.0 and xbmc 12 (Frodo).
Modifications to be done on the XBMC DB. Here MyMusic32.

# View showing the real data
CREATE ALGORITHM=UNDEFINED VIEW `XTAPCount` AS select `song`.`idSong` AS 
`Xid`,`song`.`strTitle` AS `XSTitle`,`album`.`strArtists` AS 
`XARTName`,`album`.`strAlbum` AS `XALBName`,`song`.`iTimesPlayed` AS 
`XPlaycount` from (`song` join `album`) where (`song`.`idAlbum` = 
`album`.`idAlbum`);

We will need an intermediate table to store the local and remote playcounts.

CREATE TABLE IF NOT EXISTS `XTAPCount_last` (
  `LXid` int(11) NOT NULL,
  `LXSTitle` varchar(512) NOT NULL,
  `LXARTName` varchar(512) NOT NULL,
  `LXALBName` varchar(512) NOT NULL,
  `LXPlaycount` int(11) NOT NULL,
  `LXpcdiff` int(11) NOT NULL,
  PRIMARY KEY (`LXid`),
  KEY `LXSTitle` (`LXSTitle`(333)),
  KEY `LXARTName` (`LXARTName`(333)),
  KEY `LXALBName` (`LXALBName`(333))
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table to keep the playcount differences.';

The next view will actually show the differences in playcounts.

# View to show the differences in playcounts.
CREATE OR REPLACE 
ALGORITHM = UNDEFINED
VIEW `XTAPCount_last_diff` AS 
SELECT Xid, XSTitle, XARTName, XALBName, XPlaycount, LXPlaycount, (
XPlaycount - LXPlaycount
) AS XDiff
FROM XTAPCount_last, XTAPCount
WHERE Xid = LXid
AND (
XPlaycount NOT LXPlaycount
);

Let's insert the data for the first time. We take the values as they are

insert INTO XTAPCount_last(LXid, LXSTitle, LXARTName, LXALBName, LXPlaycount )
 SELECT Xid,XSTitle,XARTName,XALBName,XPlaycount from XTAPCount;

Update the LXPlaycount (This is the initial run).

UPDATE XTAPCount_last SET LXpcdiff=LXPlaycount;

Let's prepare the same for the Amarok side.

# View showing the real data
CREATE ALGORITHM=UNDEFINED VIEW `ATAPCount` AS select distinct `tracks`.`id` 
AS `Aid`,`tracks`.`title` AS `ASTitle`,`artists`.`name` AS 
`AARTName`,`albums`.`name` AS `AALBName`,`statistics`.`playcount` AS 
`APlaycount` from (((`tracks` join `statistics`) join `artists`) join `albums`) 
where ((`tracks`.`id` = `statistics`.`id`) and (`artists`.`id` = 
`tracks`.`artist`) and (`tracks`.`album` = `albums`.`id`)) order by 
`statistics`.`playcount` desc;

Intermediate Table - where we will store local and remote (here) XBMC Playcount.

CREATE TABLE IF NOT EXISTS `ATAPCount_last` (
  `LAid` int(11) NOT NULL,
  `LASTitle` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'Song Title',
  `LAARTName` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'Artist name',
  `LAABName` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'Artist Name',
  `LAPlaycount` int(11) NOT NULL COMMENT 'Playcount',
  `LApcdiff` int(11) NOT NULL COMMENT 'Playcount difference to last time',
  PRIMARY KEY (`LAid`),
  KEY `LASTitle` (`LASTitle`(333)),
  KEY `LAARTName` (`LAARTName`(333)),
  KEY `LAABName` (`LAABName`(333))
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table containing last play state.';

LAst but not least, the View to show the differences in playcounts.

CREATE OR REPLACE 
ALGORITHM = UNDEFINED
VIEW `ATAPCount_last_diff` AS 
SELECT Aid, ASTitle, AARTName, AALBName, APlaycount, LAPlaycount, (
APlaycount - LAPlaycount
) AS ADiff
FROM ATAPCount_last, ATAPCount
WHERE Aid = LAid
AND (
APlaycount  LAPlaycount
);

Make the Initial data dump

INSERT INTO ATAPCount_last(LAid, LASTitle, LAARTName, LAABName, LAplaycount ) 
SELECT Aid,ASTitle,AARTName,AALBName,APlaycount from ATAPCount;

And put the playcount into the temporary Field LApcdiff (Amarok DB only here).

UPDATE ATAPCount_last SET LApcdiff=LAPlaycount;

Now comes the Sync Process. Depending on the number of lines you have in there, it may take some time. With 12K Songs - it takes around 12 Minutes for my DB's to sync.
Sync the Data Amarok -> XBMC

UPDATE MyMusic32.XTAPCount,ATAPCount_last_diff SET 
MyMusic32.XTAPCount.XPlaycount=(MyMusic32.XTAPCount.XPlaycount + 
ATAPCount_last_diff.ADiff) WHERE ASTitle=XSTitle AND AARTName=XARTName AND 
AALBName=XALBName and ADIff > 0;

Once this is done - set the current state with:

UPDATE ATAPCount_last,ATAPCount set LAPlaycount=Aplaycount WHERE LAid=Aid;

Put the playcount into the temporary Field LApcdiff (Amarok DB only here).

UPDATE ATAPCount_last SET LApcdiff=LAPlaycount;

Sync the Data XBMC -> Amarok

UPDATE amarokdb.ATAPCount, XATAPCount_last_diff SET 
amarokdb.ATAPCount.APlaycount=(amarokdb.ATAPCount.APlaycount + 
XATAPCount_last_diff.XDiff) WHERE ASTitle=XSTitle AND AARTName=XARTName AND 
AALBName=XALBName and XDiff > 0;

You're done. 

Entered by smurphy on Sunday, 10 March 2013 @ 16:35:17  
Nothing Specific - Common Linux problems, # Hits: 65350
spacer line
Question ? What is the Gnu Public Licence   [
View DetailsView details
|
Print ViewPrint view
]

  The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software - to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
Note that there are 2 Version of the GPL - V2 and v3 that are used at the moment.
Check the Full Paper in the related Files Section. 

Entered by smurphy on Saturday, 18 August 2007 @ 22:56:22  
Nothing Specific - META Questions, # Hits: 63213

Attach   GPL_V2.txt  [ 15,131 bytes - text/plain ]
Attach   GPL_V3.txt  [ 35,148 bytes - text/plain ]
spacer line
Question ? What does the name SOLSYS stand for ?   [
View DetailsView details
|
Print ViewPrint view
]

 As I searched for a domain name - I didn't find anything suitable for stargate (Server system). Everything was used already, but the abbreviation for the Solar System (solsys) did still exist. 

Entered by smurphy on Sunday, 17 June 2001 @ 02:00:32  
Nothing Specific - META Questions, # Hits: 63126
spacer line
Question ? What is a Kibit ? Or why does my OS show me less space than the manufacturer of the Disk ?   [
View DetailsView details
|
Print ViewPrint view
]

 Of course everyone knows that 1 Kilobyte equals to 1.024 bytes. Well - this is wrong !

A kibibit (a contraction of kilo binary digit) is a unit of information or computer storage, abbreviated Kibit, or sometimes Kib. (Note that the abbreviation is capitalized, while kbit is not.)

1 kibibit = 210 bits = 1,024 bits
1 kibibit = 27 bytes = 128 bytes

The kibibit is closely related to the kilobit, which can either be a synonym for kibibit, or refer to 103 bits = 1,000 bits, depending on context.
The National Institute of Science and Technologies notes that

it is important to recognize that the new prefixes for binary multiples are not part of the International System of Units (SI), the modern metric system.

It should also be noted that they are not in general use among professional software and electrical engineers, who generally use decimal prefixes when referring to binary quantities.

In short - we need to make the difference between the Metric Prefix system - this one handles the comon Kilo naming convention, and the Binary prefix systems - which is the real definition for binary formats as found on harddisks.

The following table shows you the comon namings and sizes

Metric (Symbol)Std. SI Binary (Symbol)Value
kilobit (kb) 103 bit kibibit (Kibit) 210 bit
megabit (Mb) 106 bit mebibit (Mibit) 220 bit
gigabit (Gb) 109 bit gibibit (Gibit) 230 bit
terabit (Tb) 1012 bit tebibit (Tibit) 240 bit
petabit (Pb) 1015 bit pebibit (Pibit) 250 bit
exabit (Eb) 1018 bit exbibit (Eibit) 260 bit
zettabit (Zb) 1021 bit zebibit (Zibit) 270 bit
yottabit (Yb) 1024 bit yobibit (Yibit) 280 bit

BTW - same also applies to the Byte fraction

Metric (Symbol)Std. SI Binary (Symbol)Value
kilobyte (kb) 103 byte kibibyte (Kibyte) 210 byte
megabyte (Mb) 106 byte mebibyte (Mibyte) 220 byte
gigabyte (Gb) 109 byte gibibyte (Gibyte) 230 byte
terabyte (Tb) 1012 byte tebibyte (Tibyte) 240 byte
petabyte (Pb) 1015 byte pebibyte (Pibyte) 250 byte
exabyte (Eb) 1018 byte exbibyte (Eibyte) 260 byte
zettabyte (Zb) 1021 byte zebibyte (Zibyte) 270 byte
yottabyte (Yb) 1024 byte yobibyte (Yibyte) 280 byte

By looking at these 2 previous tables - you might ask yourself - but what is the difference. Well - really only if you handle Bytes or Bits. This is the main differenciator.
So - what does this mean for us ? Check for yourself with some examples:

MediaMetric SystemBinary System
100GB Harddisk100 Gigabyte93,1 Gibibyte
DVD Rom 54,7 Gigabyte4,37 Gibibyte
CD Rom 700 Megabyte700 Mebibyte
1 GB Ram1,074 Gigabyte1 Gibibyte
USB Stick 8GB8 Gigabyte7,45 Gibibyte
DSL 2000 2,0 Megabit1,91 Mebibit
Memory Interface 256Bit 256 Bit256 Bit
Memory Interface 1.024Bit 1,024 Kilobit1 Kibibit
 

Entered by smurphy on Tuesday, 09 October 2007 @ 14:21:38  
Nothing Specific - META Questions, # Hits: 62295
 
Problems to  webmaster(-AT-)solsys(-DOT-)org  - best viewed @ 1920bpp
This site is powered by phpPhobos v2.0b446
© J. Mertin smurphy(-AT-)solsys(-DOT-)org 
Icons - Copyright Breeze artists GPL 2+