equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * MP3/MPlayer plugin to VDR (C++) |
2 * MP3/MPlayer plugin to VDR (C++) |
3 * |
3 * |
4 * (C) 2001-2005 Stefan Huelswitt <s.huelswitt@gmx.de> |
4 * (C) 2001-2007 Stefan Huelswitt <s.huelswitt@gmx.de> |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or |
6 * This code is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU General Public License |
7 * modify it under the terms of the GNU General Public License |
8 * as published by the Free Software Foundation; either version 2 |
8 * as published by the Free Software Foundation; either version 2 |
9 * of the License, or (at your option) any later version. |
9 * of the License, or (at your option) any later version. |
458 { |
458 { |
459 lasttime=0; modified=false; |
459 lasttime=0; modified=false; |
460 lastpurge=time(0)-(50*60); |
460 lastpurge=time(0)-(50*60); |
461 } |
461 } |
462 |
462 |
|
463 void cInfoCache::Shutdown(void) |
|
464 { |
|
465 Cancel(10); |
|
466 Save(true); |
|
467 } |
|
468 |
463 void cInfoCache::Cache(cSongInfo *info, cFileInfo *file) |
469 void cInfoCache::Cache(cSongInfo *info, cFileInfo *file) |
464 { |
470 { |
465 lock.Lock(); |
471 lock.Lock(); |
466 cCacheData *dat=Search(file); |
472 cCacheData *dat=Search(file); |
467 if(dat) { |
473 if(dat) { |
567 return AddPath(cachedir?cachedir:VideoDirectory,CACHEFILENAME); |
573 return AddPath(cachedir?cachedir:VideoDirectory,CACHEFILENAME); |
568 } |
574 } |
569 |
575 |
570 void cInfoCache::Save(bool force) |
576 void cInfoCache::Save(bool force) |
571 { |
577 { |
572 if(!Purge() && modified && (force || time(0)>lasttime)) { |
578 if(modified && (force || (!Purge() && time(0)>lasttime))) { |
573 char *name=CacheFile(); |
579 char *name=CacheFile(); |
574 cSafeFile f(name); |
580 cSafeFile f(name); |
575 free(name); |
581 free(name); |
576 if(f.Open()) { |
582 if(f.Open()) { |
577 lock.Lock(); |
583 lock.Lock(); |