| 1 | /* |
|---|
| 2 | * SapphireMetaDataSupport.h |
|---|
| 3 | * Sapphire |
|---|
| 4 | * |
|---|
| 5 | * Created by Graham Booker on Apr. 16, 2008. |
|---|
| 6 | * Copyright 2008 Sapphire Development Team and/or www.nanopi.net |
|---|
| 7 | * All rights reserved. |
|---|
| 8 | * |
|---|
| 9 | * This program is free software; you can redistribute it and/or modify it under the terms of the GNU |
|---|
| 10 | * General Public License as published by the Free Software Foundation; either version 3 of the License, |
|---|
| 11 | * or (at your option) any later version. |
|---|
| 12 | * |
|---|
| 13 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
|---|
| 14 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|---|
| 15 | * Public License for more details. |
|---|
| 16 | * |
|---|
| 17 | * You should have received a copy of the GNU General Public License along with this program; if not, |
|---|
| 18 | * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | @class SapphireMetaDataUpgrading; |
|---|
| 22 | |
|---|
| 23 | NSString *searchCoverArtExtForPath(NSString *path); |
|---|
| 24 | |
|---|
| 25 | /*! |
|---|
| 26 | * @brief The basic support class |
|---|
| 27 | * |
|---|
| 28 | * This class contains many of the support functions necessary for operation. |
|---|
| 29 | */ |
|---|
| 30 | @interface SapphireMetaDataSupport : NSObject { |
|---|
| 31 | NSTimer *writeTimer; /*!< @brief The timer to agregate writes*/ |
|---|
| 32 | NSTimeInterval interval; /*!< @brief The write interval*/ |
|---|
| 33 | BOOL locked; /*!< @brief Was the DB locked during the last save*/ |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | /*! |
|---|
| 37 | * @brief Save the context |
|---|
| 38 | * |
|---|
| 39 | * @param context The context to save |
|---|
| 40 | * @return YES if the save succeeded, NO otherwise |
|---|
| 41 | */ |
|---|
| 42 | + (BOOL)save:(NSManagedObjectContext *)context; |
|---|
| 43 | |
|---|
| 44 | /*! |
|---|
| 45 | * @brief Was the DB locked in last save? |
|---|
| 46 | * |
|---|
| 47 | * @return YES if it was locked, NO otherwise |
|---|
| 48 | */ |
|---|
| 49 | + (BOOL)wasLocked; |
|---|
| 50 | |
|---|
| 51 | /*! |
|---|
| 52 | * @brief Import the old plist into the context |
|---|
| 53 | * |
|---|
| 54 | * @param v1Context The context to use for old objects |
|---|
| 55 | * @param context The context to use for new objects |
|---|
| 56 | * @param display The display for UI feedback |
|---|
| 57 | */ |
|---|
| 58 | + (void)importV1Store:(NSManagedObjectContext *)v1Context intoContext:(NSManagedObjectContext *)context withDisplay:(SapphireMetaDataUpgrading *)display; |
|---|
| 59 | |
|---|
| 60 | /*! |
|---|
| 61 | * @brief Import the old plist into the context |
|---|
| 62 | * |
|---|
| 63 | * @param configDir The directory containing old configuration files |
|---|
| 64 | * @param context The context to use for new objects |
|---|
| 65 | * @param display The display for UI feedback |
|---|
| 66 | */ |
|---|
| 67 | + (void)importPlist:(NSString *)configDir intoContext:(NSManagedObjectContext *)context withDisplay:(SapphireMetaDataUpgrading *)display; |
|---|
| 68 | |
|---|
| 69 | /*! |
|---|
| 70 | * @brief Get the path for the collection art |
|---|
| 71 | * |
|---|
| 72 | * @return The base collection art path |
|---|
| 73 | */ |
|---|
| 74 | + (NSString *)collectionArtPath; |
|---|
| 75 | |
|---|
| 76 | @end |
|---|