- 
                Notifications
    
You must be signed in to change notification settings  - Fork 164
 
[Waiting for fastapi-dev] 支持将设备使用状态存储到SQLite,并提供ManicTime时间线xml接口 #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            Moonia-Cherry
  wants to merge
  5
  commits into
  sleepy-project:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
Moonia-Cherry:main
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    
      
        
              This comment was marked as off-topic.
        
        
      
    
  This comment was marked as off-topic.
          
  | 
    
| 
           想了想,如果直接 commit 可能有很多人不需要这个功能,而且代码会很乱 
  | 
    
          
 均可,由你决定😉若有相关需要随时欢迎再来contact me (以及,我其实也是看到了那个智学网和steam这两个附加功能才决定直接提pr的,以为是一个聚合的仓库  | 
    
          
 影响统计的话...加一个应用 ID?  | 
    
| 
           still not available lol  | 
    
| 
           😭😭😭  | 
    
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    

描述
我超喜欢这个视奸页面!(bushi
然鹅发现此项目并没有内置历史数据存储功能,于是基于个人数据分析兴趣,增加了存储设备使用情况到SQLite的功能,数据库表与字段将在下面列出;
因为我在使用ManicTime记录pc的日常生活时间,而此软件可以以自定义网络源新增时间轴,本质上是一个返回
xml的get请求,时间轴根据获取的xml生成时间轴,结合上述已存储好的数据,即可将数据在时间轴上可视化了,在我的使用中,这主要针对于手机,但我预留了其它设备的数据存储与读取(用设备标识符区分)。下图为样例,其中PhoneUsage为读取到的数据

新增的api也将在下面列出;
表结构
Events
app_name改变了的/device/set接口被调用时,插入一行ColorGroup
Events表插入行时,若插入的app_name在此表group_name字段的所有行中均没有,则插入一行'#a0ad9e'0set字段在代码内目前还没有相关逻辑;预期是加入设置组颜色接口,在调用时将set设置为1,此为预留字段api
ManicTime
获取ManicTime自定义网络源要求的
xmlTip
本接口由ManicTime软件自动调用,软件内设置时,只需设置到
.../sampleData/CustomTimeline?id=<id>即可Params
<id>: 设备标识符<FromTime>:要获取的数据的开始时间,格式为%Y-%m-%dT%H:%M:%S<ToTime>:要获取的数据的结束时间,格式为%Y-%m-%dT%H:%M:%SResponse